stereopi-tutorial
stereopi-tutorial copied to clipboard
Rotating Cameras before they are put into the preview frame
The title says my problem, I am having a hard time rotating each camera before they are put into the frame. I tried setting stereo_mode into top-bottom and then rotating the whole frame itself but since the resolutions are mixed up I am seeing green statics
Hi! Try to set vertical flip. As an example, you can look in the 1_test.py code, row 60:
camera.hflip = True
In your case you may try to use vflip this way:
camera.vflip = True
p.s. Please keep this camera settings in all your code (including calibration images capture and depth map)
Oh I need to rotate it by 90 degrees, hflip and vflip only allows you 180 degrees rotation.
Ough, 90 degree rotation is a problem in stereoscopic mode. I describe this issue in this article https://stereopi.com/blog/diy-vr-headset-stereopi-10-ms-latency-just-135 (search by "Problem #3" At this moment we use physical camera rotation. If you're using this setup not for the user 3D view, but for OpenCV processing, you can capture stereoscopic pair with rotated images, and rotate each 90 degree after cut it on pairs and before processing.
If you're using this setup not for the user 3D view, but for OpenCV processing, you can capture stereoscopic pair with rotated images, and rotate each 90 degree after cut it on pairs and before processing.
Yeah this is what I'm doing right now, I just think that it'll be a bit disorienting for the would-be users if they are to adjust an object in a rotated preview before they can capture an image
It would be nice if we can just communicate with the registers in the camera directly. I've been looking on how to modify them so that they automatically rotate on their own, but I can't seem to find a way to change the values in the camera's register
Yeah this is what I'm doing right now, I just think that it'll be a bit disorienting for the would-be users if they are to adjust an object in a rotated preview before they can capture an image
That's why in our code we're not using native camera preview feature, but show already captured and processed images by means of Python's imshow
. You can rotate images before showing them to the user.
It would be nice if we can just communicate with the registers in the camera directly. I've been looking on how to modify them so that they automatically rotate on their own, but I can't seem to find a way to change the values in the camera's register
Unfortunately, low-level RPi camera ecosystem is closed. I2C is occupied with the VPU system, and you can not access camera registers, if you want to use native applications like PiCamera or raspivid/raspistill etc. But you can access a registers if you 'll write your own driver, and this way you can access the video by, say, raspiraw or V4L. This is a hard way for experienced users.
Hi, I have the same issue.
For my project, I am not using the mounting provided in stereopi kit. I had to design a custom mounting due to space restrictions.
Now, the left camera is rotated 90 degree anticlockwise and the right camera 90 degrees clockwise as the ribbions had to go through the center of the mounting.
Please suggest me the correct way. I did following modifications to the 1_test.py given in the tutorial which is not working properly:
for frame in camera.capture_continuous(capture, format="bgra", use_video_port=True, resize=(img_width, img_height)): counter+=1
img_width_1 = int (cam_width * scale_ratio / 2)
frame_left = frame[:, :img_width_1, :]
frame_right = frame[:, img_width_1:, :]
frame_left_clockwise = cv2.flip(cv2.transpose(frame_left), 0)
frame_right_anticlockwise = cv2.flip(cv2.transpose(frame_right), 1)
combined_frame = np.hstack((frame_left_clockwise, frame_right_anticlockwise))
cv2.imshow("pair", combined_frame)