Latency Reading the camera - with AGX - and showing on Display

Hi,

I have a USB3.0 camera which can supply upto 60fps @ 1080p resolution. Just capturing the image and showing it on the display without any processing, seems causing more than 140ms delay. Below are three different code samples I tried, one of which is using the Jetson Inference tools, Couldnt have any success decreasing the latency. Any suggestions is much appreciated.
Thanks

import cv2

cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_BUFFERSIZE, 1)

while True:
 
  ret_val1, img1 = cap.read()
  cv2.imshow('Org', img1)

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

cap.release()
cv2.destroyAllWindows()

import cv2

cap = cv2.VideoCapture("nvv4l2camerasrc device=/dev/video1 cap-buffers = 2 !
video/x-raw(memory:NVMM),width=1280,height=720,framerate=30/1 !
nvvidconv !
video/x-raw, format=(string)BGRx ! videoconvert !
video/x-raw,format=BGR !
appsink sync=0 ")

while True:

ret_val1, img1 = cap.read()
cv2.imshow(‘Org’, img1)

if cv2.waitKey(1)==ord(‘q’):
break

cap.release()
cv2.destroyAllWindows()

import jetson.utils

cam=jetson.utils.gstCamera(1280,720,‘/dev/video0’)
disp = jetson.utils.glDisplay()
font = jetson.utils.cudaFont()

while disp.IsOpen():
frame, width, height = cam.CaptureRGBA()
disp.RenderOnce(frame,width,height)

cam.release()

Hi,
We suggest try gst-launch-1.0 and check the latency for comparison. May try the two cases:

nvv4l2camerasrc device=/dev/video1 cap-buffers = 2 !
video/x-raw(memory:NVMM),width=1280,height=720,framerate=30/1 !
nvvidconv ! nvoverlaysink
v4l2src ! videoconvert ! xvimagesink