Hi all.
I’m beginner.
I want to use two cameras to show two camera images on one display.
I am also using the code in jetson-inference.
import cv2
import numpy
import jetson.inference
import jetson.utilsnet = jetson.inference.detectNet(“ssd-mobilenet-v2”, threshold=0.5)
camera = jetson.utils.gstCamera(1280, 720, “/dev/video0”)
display = jetson.utils.glDisplay()
i = 0
flag = True
captures =while(flag):
capture = cv2.VideoCapture(i)
ret, frame = capture.read()
flag = ret
if flag:
i += 1
captures.append(capture)while(True):
key = cv2.waitKey(1) & 0xFF
if key == ord(’ '):
breakfor i, capture in enumerate(captures): ret, frame = capture.read() frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) width = numpy.shape(frame)[1] height = numpy.shape(frame)[0] jetson.utils.cudaDeviceSynchronize() img = jetson.utils.cudaFromNumpy(frame) detections = net.Detect(img, width, height) for detection in detections: print(net.GetClassDesc(detection.ClassID)) display.RenderOnce(img, width, height) #display.SetTitle("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))capture.release()
cv2.destroyAllWindows()
Frame appears alternately.
I saw the part related to Display of jetson.utils, but I could not understand it, so I tried it with opencv.
It may be wrong to hear this, but please tell me how to display it at the same time.
Thank you