Broken Stereoscopic Support in Raspbian Stretch

OpenCV, Python and other image processing questions
Post Reply
fraserbarton
Posts: 18
Joined: Sun Oct 06, 2019 11:55 am

Broken Stereoscopic Support in Raspbian Stretch

Post by fraserbarton »

I am currently experiencing issues with the stereoscopic mode, I am running Raspbian stretch and Python 3.5.3.

If I run

Code: Select all

raspistill -cs 0
or

Code: Select all

raspistill -cs 1
I get the preview from either camera happily.

Running

Code: Select all

raspistill
to bring up the various options I can pass, I can see that -3d is listed. However, if I run

Code: Select all

raspistill -3d
I get an 'Invalid command line option (-3d)' response.

I can happily get grabs from a singular camera using a simple python script:

Code: Select all

from picamera import PiCamera
import time

camera = PiCamera(resolution=(480, 320))
time.sleep(2)

camera.capture('jpeg-test-shot.jpeg')
However if I pass stereoscopic mode as an option the script just hangs when I try and execute it i.e.

Code: Select all

from picamera import PiCamera
import time

camera = PiCamera(stereo_mode='side-by-side', resolution=(480, 320))
time.sleep(2)

camera.capture('jpeg-test-shot-stereo.jpeg')
Once I have force closed the program above I then find that I cannot access the camera resources at all

Please not I am not running any particular version for any particular reason, so please tell me if you spot conflicting versions please point this out for me. This issue seems to be similar to the Raspbian Buster kernel issue from this forum:

https://forum.stereopi.com/viewtopic.php?f=9&t=744

Fortunately I am at a stage in this project where I am free to fresh install the OS and all software on the StereoPi and not lose any time. It would be good if someone (possibly an administrator) could point me towards a known set of working compatible versions? What is the most stable known combination?

(Results from running cat /etc/os-release)
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

(Python Version)
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.

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

Re: Broken Stereoscopic Support in Raspbian Stretch

Post by stereomaton »

I (quickly) answer only to the first part.
The -3d option needs a value, see https://forum.stereopi.com/viewtopic.php?f=11&t=43 for example.
Doc: https://www.raspberrypi.org/documentati ... /camera.md
Stereophotographer and hacker
Despite my quite active participation in the forum, I am not in the StereoPi team
StereoPi (v1) Standard Edition + CM3Lite module + a few cameras

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

Re: Broken Stereoscopic Support in Raspbian Stretch

Post by Realizator »

Hi Fraserbarton,
Stereomaton is right - you need to add extra option like "sbs" to your command line. I.e. try this:

Code: Select all

raspistill -3d sbs
As for you second issue (like no access to the camera after forcing stereoscopic mode in Python). Looks like you faced an issue I mention several months ago here on GitHub. To say briefly:
- new AWB algorithm is implemented in Raspbian, and it broke stereoscopic support
- To fix it run once after reboot "sudo vcdbg set awb_mode 0" BEFORE accessing a camera

As I mentioned in our last article in "Section 2 – Detailed debriefing", we added this command to "/etc/rc.local" to avoid manual run after each boot.

Raspberry Pi Foundation promised to fix this issue in upcoming releases. Now they have a couple of StereoPi, and I hope they can do a tests of stereoscopic mode. :-)

UPDATE> As for the stable release - this AWB "feature" now exists in both Stretch and Buster (with the latest kernels). If you can choose a platform for your project - it is better to use Buster. Our latest OpenCV image is based on Buster, and we plan to update our SLP image to Buster too.
Eugene a.k.a. Realizator

fraserbarton
Posts: 18
Joined: Sun Oct 06, 2019 11:55 am

Re: Broken Stereoscopic Support in Raspbian Stretch

Post by fraserbarton »

Apologies I was using the -3d option incorrectly, that makes sense that it would require an option like side by side or top and bottom.

Although when I do pass the sbs option the preview window just freezes over the top of raspbian so it is more likely to be this kernel issue.

I had tried to use the sudo vcdbg set awb_mode 0 fix but this did not resolve any of my issues.

I will fresh install the SD Card with the StereoPi build of Buster. Thanks for the coherent advice. When I first started out working from the Wiki I didn't find that I was being point to important information such as your GitHub (https://github.com/realizator/stereopi-fisheye-robot). The written explanations are much better than just a set of download links to someone who is new to the Pi platform.

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

Re: Broken Stereoscopic Support in Raspbian Stretch

Post by Realizator »

Update: rpi-update solves this issue now, and stereoscopic support works again.
Related issue on Github: https://github.com/raspberrypi/firmware ... -614081437
Eugene a.k.a. Realizator

Post Reply