I executing a python prgm, using opencv version 4.1.1 on a Jetson nano 2gb SOM.
With only 1 camera active:
– pi camera active I get almost zero latency.
– webcam active is about 1.5 seconds of latency
with two(2) camera active:
– pi camera active there is approx. 7.5 latency.
– webcam active there is approx. 1.5 seconds latency
Is it possible to obtain zero sec latency with 2 camera running videos streams.
Would it be possible for you to share your application code? Or at least a snipped where you run video capture, so we can have a better understanding of your system.
regards,
Andrew
Embedded Software Engineer at ProventusNova
import cv2
print(cv2.version)
dispW=640 # display Width originally set 320 or 640
dispH=480 # display Height originally set 240 or 480
flip=4 # for picture orientation original set to 4 or 2
camSet=‘nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method=’+str(flip)+’ ! video/x-raw, width=‘+str(dispW)+’, height=‘+str(dispH)+’, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink’
piCam=cv2.VideoCapture(camSet) # created pi camera object
webCam=cv2.VideoCapture(1) # webcam
while True: # True
ret, piframe=piCam.read() # grab a frame
ret, webframe=webCam.read()
webframe=cv2.resize(webframe,(640, 480)) # changed from size
# from 3264 x 2464
cv2.imshow('piCam', piframe) # show or display frame
cv2.imshow('webCam', webframe)
cv2.moveWindow('piCam',0,20)
cv2.moveWindow('webCam',650,20)
if cv2.waitKey(1)==ord('q'): # ord q quit
break
piCam.release() # release camera
webCam.release()
cv2.destoryAllWindows()
The code executed that has video latency is shown below:
import cv2
print(cv2.version)
dispW=640 # display Width originally set 320 or 640
dispH=480 # display Height originally set 240 or 480
flip=4 # for picture orientation original set to 4 or 2
camSet=‘nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method=’+str(flip)+’ ! video/x-raw, width=‘+str(dispW)+’, height=‘+str(dispH)+’, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink’
piCam=cv2.VideoCapture(camSet) # created pi camera object
webCam=cv2.VideoCapture(1) # webcam
while True: # True
ret, piframe=piCam.read() # grab a frame
ret, webframe=webCam.read()
webframe=cv2.resize(webframe,(640, 480)) # changed from size
# from 3264 x 2464
cv2.imshow('piCam', piframe) # show or display frame
cv2.imshow('webCam', webframe)
cv2.moveWindow('piCam',0,20)
cv2.moveWindow('webCam',650,20)
if cv2.waitKey(1)==ord('q'): # ord q quit
break
piCam.release() # release camera
webCam.release()
cv2.destoryAllWindows()
Thanks for sharing the code.
I will try to replicate the issue on my end.
I am having issues with my webcam not being detected by my Jetson, will look into that.
In the meantime, have you tried running the same test but using GStreamer only through the terminal?
regards,
Andrew
Embedded Software Engineer at ProventusNova