PiCamera preview hangs

Raspberry Pi cameras (V1, V2, wide angle etc), HDMI capture modules etc.
Post Reply
Jimbo42
Posts: 3
Joined: Tue Jun 16, 2020 2:58 pm

PiCamera preview hangs

Post 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.

stereomaton
Posts: 165
Joined: Tue May 21, 2019 12:33 pm
Location: France

Re: PiCamera preview hangs

Post 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.
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi Standard Edition + CM3Lite module + a few cameras

Jimbo42
Posts: 3
Joined: Tue Jun 16, 2020 2:58 pm

Re: PiCamera preview hangs

Post 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.

User avatar
Realizator
Site Admin
Posts: 549
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: PiCamera preview hangs

Post 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.
Eugene a.k.a. Realizator

Jimbo42
Posts: 3
Joined: Tue Jun 16, 2020 2:58 pm

Re: PiCamera preview hangs

Post 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

Post Reply