raspbian bullseye and stereomode

OpenCV, Python and other image processing questions
Post Reply
User avatar
zoldaten
Posts: 48
Joined: Fri Apr 26, 2019 7:07 am

raspbian bullseye and stereomode

Post by zoldaten »

hi!
I`m trying to start stereo mode on Raspbian x64 bullseye with picamera2 and stereopiV2.

Everything works but only with 1 camera at once:

Code: Select all

import os;import cv2;import numpy as np;from datetime import datetime
#from picamera.array import PiRGBArray
#from picamera import PiCamera
from picamera2 import MappedArray, Picamera2, Preview

# Initialize the camera
#     camera = PiCamera(stereo_mode='side-by-side',stereo_decimate=False)
#     camera.resolution=(cam_width, cam_height)
#     camera.framerate = 5
#     camera.exposure_mode = 'off'     
#     camera.shutter_speed = 1000000    
#     camera.contrast = 0  # Контрастность
#     camera.brightness = 60  # Яркость
#     camera.saturation = 0  # Насыщенность
#     camera.ISO = 800  # Чувствительность
#     camera.awb_mode = "auto"  # "fluorescent"
camera = Picamera2()

config = camera.create_preview_configuration(main={"format": "RGB888"})
camera.configure(config)
camera.start_preview(Preview.QT)
camera.start()
        
#for frame in camera.capture_continuous(capture, format="bgr", use_video_port=True,
                                       #resize=(img_width,img_height)):    
while True:    
    origin_img = camera.capture_array()
I see 2 cameras registered:

Code: Select all

[0:29:08.795269441] [5481]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3700-f30ad033
[0:29:08.832856316] [5490]  INFO RPI raspberrypi.cpp:1368 Registered camera /base/soc/i2c0mux/[email protected]/[email protected] to Unicam device /dev/media3 and ISP device /dev/media0
As stereopi wiki suggested i put .bin file to /boot partition and added to config.txt what it needs.

How to start up stereo mode ?

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

Re: raspbian bullseye and stereomode

Post by Realizator »

Hi Zoldaten,

Huh, libcamera is still in the early stage... And the stereoscopic mode activation works another way.

I can help you with two pieces of information:
1. Here is our first experiment of getting two images from two cameras using libcamera: https://forums.raspberrypi.com/viewtopi ... 9#p1965619

2. As for Picamera2 - by default it has no stereoscopic mode, but here is an answer from the Picamera2 maintainer on RPF website: https://www.raspberrypi.com/news/a-prev ... nt-1581093

I hope this can help.
Eugene a.k.a. Realizator

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

Re: raspbian bullseye and stereomode

Post by Realizator »

I've played with Picamera 2 today. Well, it's working in some cases, but I wasn't able to get the stable stream from both cams at the same time.

After digging I localized the issue using on of the simplest examples, and opened an issue on GitHub.

While they are fixing this, I'm going to play with transferring two videos from libcamera to python script over pipe, with no Picamera/Picamera2 at all. We used this approach in our C++ examples (here is an article).
Eugene a.k.a. Realizator

neaveeng
Posts: 8
Joined: Wed May 06, 2020 4:26 pm

Re: raspbian bullseye and stereomode

Post by neaveeng »

Any update on the libcamera testing please? I'm really starting to feel the pain of having to remain on the old 32bit OS is all, if there's an example script you could share for capturing simultaneous images on Bullseye 64bit I'd massively appreciate it.

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

Re: raspbian bullseye and stereomode

Post by Realizator »

Hey neaveeng,

Things are moving slowly... I'm still trying to find the combination of picamera1/2 and lib camera to get a stable result.
Eugene a.k.a. Realizator

neaveeng
Posts: 8
Joined: Wed May 06, 2020 4:26 pm

Re: raspbian bullseye and stereomode

Post by neaveeng »

Cool, I'll do some tinkering too. I can't imagine I'll have better luck than you but not knowing how anything works I may stumble on something by accident! 🤣

Post Reply