Issue with accessing camera in jetson nano

Hi i am having trouble accessing camera it gives me green secreen

my camera is imx219-83 stereo camera and i trayd this solution How to slove opencv green screen? - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums
it didnt work for me

when i run this code
import cv2
from ultralytics import YOLO
# Load the YOLOv8 model model = YOLO('yolov8n.pt')
# Open the video file `

video_path = “0”``

cap = cv2.VideoCapture(‘nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1280, height=720, format=(string)RG10, framerate=(fraction)15/1 ! nvvidconv ! video/x-raw, format=(string)RGRG ! videoconvert ! video/x-raw, format=(string)BGR ! appsink’, cv2.CAP_GSTREAMER)

Loop through the video frames

while cap.isOpened():

Read a frame from the video``

success, frame = cap.read()
if success:

Run YOLOv8 inference on the frame

results = model(frame)

Visualize the results on the frame annotated_frame = results[0].plot()

Display the annotated frame

cv2.imshow(“YOLOv8 Inference”,annotated_frame)

Break the loop if ‘q’ is pressed

if cv2.waitKey(1) & 0xFF == ord(“q”):``
break
else:

Break the loop if the end of the video is reached

break

Release the video capture object and close the display window

cap.release()``cv2.destroyAllWindows()

nothing happens , and i tried to use usb web cam it worked with me and i did some debugging it seems that opencv can’t read from the camera

can you help me with that thank you very much

Hi,
It looks like the camera is not supported by default. You would need to check sensor driver programming guide to bringup the camera board firtst.

Or you may try
Buy a Raspberry Pi Camera Module 2 – Raspberry Pi

The camera is enabled by default.

The pipeline doesn’t look correct. gstreamer doesn’t support bayer 10 bits format.
Though, for an IMX219 sensor, nvarguscamerasrc would output the video stream in NV12 format (in NVMM memory).

First try to read camera and display (assuming you’re locally logged in with GUI in local monitor):

gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! nv3dsink

If this doesn’t work, you would have to fix that first. Note that the RPi v2 camera is supported by default, but for IMX219 cameras from other vendors you may have to install an SDK. Check with camera vendor.

When this works, you would just use:

cap = cv2.VideoCapture('nvarguscamerasrc ! video/x-raw(memory:NVMM), format=NV12, width=1280, height=720, framerate=15/1 ! nvvidconv ! video/x-raw, format=BRGx ! videoconvert ! video/x-raw, format=BGR ! appsink drop=1', cv2.CAP_GSTREAMER)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.