Page 1 of 1

PiCamera preview hangs

Posted: Tue Jun 16, 2020 3:11 pm
by Jimbo42
I have the cameras setup and working when you issue the commands for raspistill on both cameras. I have tried to get the PiCamera module to work with very little success:

Simple script:

from picamera import PiCamera
from time import sleep

try:
camera = PiCamera(stereo_mode='side-by-side', resolution=(1280, 720))
camera.start_preview()
sleep(2)
camera.capture( 'foo2.jpg )
finally:
camera.close()

If I comment out the start_preview line I will actually get a jpg with a image of the two cameras side by side. If I leave the preview line in then the program hangs. The LED for camera 0 is lit and stays lit, but the LED for camera 1 never lights up.

Any help is appreciated.

Re: PiCamera preview hangs

Posted: Wed Jun 17, 2020 9:42 am
by stereomaton
Can you provide information about the system you are trying to run this code on?

I remember a bug in the white balance in Raspberry's proprietary/opaque blob that produced similar effects (freeze on preview, only one photo possible). A temporary solution is proposed in this post: viewtopic.php?f=9&t=744#p1293
If it solves your problem, you can add the command in /etc/rc.local or update the whole system as the bug is now resolved.

If it is not the problem you face, you can start by checking each camera independently.

About the LEDs, only one is lit even in stereo mode.

Re: PiCamera preview hangs

Posted: Wed Jun 17, 2020 12:04 pm
by Jimbo42
I am running a CM3+ with two Waveshare "G" cameras. The solution suggested for running the command: sudo vcdbg set awb_mode 0
prior to running the code did in fact work.

Thanks for your help - greatly appreciated.

Re: PiCamera preview hangs

Posted: Thu Jun 18, 2020 8:07 am
by Realizator
Stereomaton, thank you for your help!
Jimbo42, actually this bug is already fixed by Raspberry Pi Foundation. Now you can do "sudo rpi-update" to get newest firmware, and all options will work out of the box.

Re: PiCamera preview hangs

Posted: Fri Jun 19, 2020 7:27 pm
by Jimbo42
Thanks for that Feedback Eugene ... I did try this first the other day but the update failed ... I don't know why ... I tried again and yes this did fix the bug. I appreciate your attention.

Jim