Open Arducam with OpenCV in Jetson

I’m working with the ArduCAM B0449, on a Jetson Orin Nano, which works perfectly running it with gst-launch-1.0 nvarguscamerasrc, but when I try to use it with opencv it doesn’t give me a clear image.

this is mi code:
import cv2

cap = cv2.VideoCapture(0)

cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*‘RG10’))
#[0]: ‘RG10’ (10-bit Bayer RGRG/GBGB)

cv2.namedWindow(‘Frame’, cv2.WINDOW_NORMAL)
cv2.resizeWindow(‘Frame’,640,480)

if not cap.isOpened():
print(“Error al abrir la cámara”)
exit()

while True:
ret, frame = cap.read()
if not ret:
print(“Error al leer el frame”)
break

cv2.imshow('Frame', frame)

if cv2.waitKey(1) & 0xFF == ord('q'):
    break

cap.release()
cv2.destroyAllWindows()

and my result is:

whith print(cv2.getBuildInformation()) I get:
Video I/O:
FFMPEG: YES
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: NO
GStreamer: YES (1.20.3)
v4l/v4l2: YES (linux/videodev2.h)

How to improve the image to use OpenCV with this camera?

Hi,
You might not be able to skip gstreamer to capture the image data from the CSI camera. I’ve attached some Python demos for your review:

it works with simple_camera.py

thanks