I want to capture two 1920x1440 images but i get black screen when i try it.
5 or 10 fps is enough for me.
Is it possible ?
If possible, would you send sample code

Thanks in advance

Code: Select all
cam_width = 640*4
cam_height = 480*2
scale_ratio = 0.5
# Buffer for captured image settings
img_width = int (cam_width * scale_ratio)
img_height = int (cam_height * scale_ratio)
capture = np.zeros((img_height*img_width*3), dtype=np.uint8)
# Initialize the camera
camera = PiCamera(stereo_mode='side-by-side', stereo_decimate=False)
camera.resolution=(cam_width, cam_height)
camera.framerate = 20
camera.hflip = True
camera.vflip = True
for frame in camera.capture_continuous(capture, format="bgr", use_video_port=False, resize=(img_width,img_height)):
frame = frame.reshape((480, 1280, 3))
imgL = frame[0:img_height, 0:img_width/2]
imgR = frame[0:img_height, img_width/2:img_width]
Code: Select all
Why do we use BGRA capture, but not BGR?
As we mentioned before, we resize the images using the GPU, and a native GPU format is BGRA (or RGBA, as you wish). If you use BGR you will find two issues; the first is a lower FPS (about 10–20% in our case) and the second is a PiCamera warning «PiCameraAlfaStripping: using alpha-stripping to convert to non-alpha format; you may find equivalent alpha format faster”. Googling this error led us to PiCamera documentation where we found the BGRA method.