Bonjour à toutes et tous,
Je voudrais simplement afficher ma webcam mais l'image apparait à l'envers (haut/bas).
Je ne trouve pas la commande qui peut retourner mon image.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
 
import pygame
import pygame.camera
from pygame.locals import *
 
DEVICE = '/dev/video0'
SIZE = (800, 600)
FILENAME = 'capture.jpg'
 
meter=('average','spot','backlit','matrix')
 
awb=('off','auto','sunlight','cloudy','shade','tungsten','fluorescent','incandescent','flash','horizon')
 
pygame.init()
pygame.camera.init()
display = pygame.display.set_mode(SIZE, 0)
camera = pygame.camera.Camera(DEVICE, SIZE)
 
pygame.camera.awb_mode = awb[4]
pygame.camera.meter_mode = meter[3]
camera.set_controls(vflip = True)
 
screen = pygame.surface.Surface(SIZE, 0, display)
 
camera.start()
 
 
capture = True
while capture:
    screen = camera.get_image(screen)
    display.blit(screen, (0,0))
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == KEYDOWN and event.key == K_q:
            capture = False
        elif event.type == KEYDOWN and event.key == K_s:
            pygame.image.save(screen, FILENAME)
            capture = False
camera.stop()
pygame.quit()
Voici l'erreur que j'obtiens :
Traceback (most recent call last):
File "/home/pi/test_webcam.py", line 21, in <module>
camera.set_controls(vflip = True)
TypeError: set_controls() takes no keyword arguments

Merci pour votre aide.
A+