Comment 0 for bug 1857438

Revision history for this message
cr (cr-newton) wrote :

Package: pygame, Version: 1.9.4.post1 (Location: /usr/lib/python3/dist-packages)

I'm unable to take an image of an usb-camera highter than 160x120 resolution on Raspberry pi 4 with python3, my desired resolution is 640x480.

setup:
RPI4 (1gb), latest raspbian buster(2019-09-26), fully updated (rpi-update): Linux raspberrypi 4.19.88-v7l+ #1284 SMP Wed Dec 11 13:51:57 GMT 2019 armv7l GNU/Linu usb camera: Logitech, Inc. HD Webcam C525

software:

    Python 3.7.3
    Pygame Version: 1.9.4.post1 (Location: /usr/lib/python3/dist-packages)
    pip3: pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

minimal script I use: (executed as 'sudo python3 test.py')

               pygame.init()
               pygame.camera.init()
               cam = pygame.camera.Camera("/dev/video0",(640,480))
               cam.start()
               image = cam.get_image()
               pygame.image.save(image,'demo_camera.jpg')
               cam.stop()
               pygame.camera.quit()

behaviour:
script hangs when calling cam.get_image() when I change the resolution to 160x120 (or lower) it works and generates an image of 160x120

When I put the sd card into my RPI3 the script works with my desired resolution of 640x480.

The camera itself is able to capture images of 640x480, the following command results in a picture of requested resolution:
fswebcam -r 640x480 image.jpg
fswebcam -r 1280x720 image.jpg

relevant information:
the usb camera creates 2 /dev/video devices, behaviour described here by someone else: https://raspberrypi.stackexchange.com/questions/100395/single-webcam-using-dev-video0-and-dev-video1