Gstream for Arducam 2MP OV2311 for Jetson

I got my “Arducam 2MP OV2311 Global Shutter M12 Mount NoIR Mono Camera Modules for Jetson Nano” up and running on my Jetson (arducam_displayer works).

I use the Jetson for object detection using this:

In the software the cameras are defined as:

def open_cam_usb(dev, width, height): """Open a USB webcam.""" if USB_GSTREAMER: gst_str = ('v4l2src device=/dev/video{} ! ' 'video/x-raw, width=(int){}, height=(int){} ! ' 'videoconvert ! appsink').format(dev, width, height) return cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER) else: return cv2.VideoCapture(dev)

def open_cam_onboard(width, height):
“”“Open the Jetson onboard camera.”""
gst_elements = str(subprocess.check_output(‘gst-inspect-1.0’))
if ‘nvcamerasrc’ in gst_elements:

On versions of L4T prior to 28.1, you might need to add

‘flip-method=2’ into gst_str below.

gst_str = ('nvcamerasrc ! ’
'video/x-raw(memory:NVMM), ’
'width=(int)2592, height=(int)1458, ’
'format=(string)I420, framerate=(fraction)30/1 ! ’
'nvvidconv ! ’
'video/x-raw, width=(int){}, height=(int){}, ’
'format=(string)BGRx ! ’
‘videoconvert ! appsink’).format(width, height)
elif ‘nvarguscamerasrc’ in gst_elements:
gst_str = ('nvarguscamerasrc ! ’
'video/x-raw(memory:NVMM), ’
'width=(int)1920, height=(int)1080, ’
'format=(string)NV12, framerate=(fraction)30/1 ! ’
'nvvidconv flip-method=2 ! ’
'video/x-raw, width=(int){}, height=(int){}, ’
'format=(string)BGRx ! ’
‘videoconvert ! appsink’).format(width, height)
raise RuntimeError(‘onboard camera source not found!’)
return cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)

I would like to include a Gstreamer comand for my Arducam, such that I can use the camera for object detection. I have spent Days trying to solv this without any sucess. Can some one please help me.