Forums - Opencv for stereoscopic processing

2 posts / 0 new
Last post
Opencv for stereoscopic processing
vikaash.kb
Join Date: 16 Aug 21
Posts: 3
Posted: Sat, 2024-04-13 10:13

Hi ,

I am working on building a custom application on RB5 to get two camera inputs do some processing(stereo rectification and translation) and render it on two separate displays . Can you suggest some ways to do it on RB5 ? I have the cameras up and working with gstreamer command. All I need is a way to get frames in application and steps to build the application. Is there any way I can do it on application or need to create a CHI-CDK custom node to process them?

  • Up0
  • Down0
sanjjey.a.sanjjey
Join Date: 17 May 22
Posts: 60
Posted: Mon, 2024-05-20 02:14

Hi,

Use Opencv to capture the frames through the camera and convert those frames into images for visualization.

 

For reference, you can check the below script.

import cv2
def capture_single_frame_resize_and_save(file_path="single_frame", camera_index=0, width=224, height=224): 
    # Initialize video capture 
    cap = cv2.VideoCapture(camera_index) 
    # Capture a single frame 
    ret, frame = cap.read() 
    # If the frame is successfully captured 
    if ret: 
        # Resize the frame 
        resized_frame = cv2.resize(frame, (width, height)) 
        # Save the frame in .jpg format 
        image_file_path = f"{file_path}.jpg"  # Update file name with .jpg extension 
        cv2.imwrite(image_file_path, resized_frame) 
        print("Resized frame saved as:", image_file_path)
 
Thanks

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.