Jetson-inference video-viewer displays rtsp, but jetson.utils.videoSource fails to make the glDisplay() window

I followed the video tutorial from Dusty to get real-time object recognition working and works fine with my ye-olde webcam on usb (/dev/video0).

Below is my (user info changed for security)

import jetson.inference
import jetson.utils

net = jetson.inference.detectNet("ssd-mobilenet-v2", threshold=0.80)
#camera = jetson.utils.gstCamera(1280, 720, "/dev/video0")
camera = jetson.utils.videoSource("rtsp://user:pass@")

display = jetson.utils.glDisplay()

while display.IsOpen():
    img, width, height = camera.CaptureRGBA()
    detections = net.Detect(img, width, height)
    display.RenderOnce(img, width, height)
    display.SetTitle("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))

But, when I go to run the .py, it says it failed to create a window. (see screenshot)

When I run the uri through video-viewer via command line, the video pops up as expected, but running it through the .py above gives the error.

Did I do something wrong? There are very few code examples and I’m very new to Python.

Hi @SteveAtSWS, can you try creating the display object first, or trying to confirm that works for you?

python3 rtsp://user:pass@

I tried running the code you mentioned:

python3 rtsp://user:pass@

and it did bring up a detection window as expected. I dont know what you mean by “try creating the display object first” though, again, i’m new to Python.

Alright, @dusty_nv, I moved “display = jetson.utils.glDisplay()” above everything else and now it’s giving me a different error:

After a significant amount of digging through detectnet code, i figured out CaptureRGBA() doesn’t exist, and for videoSource it should be .Capture(), also remove the Width and Height from the capture, detection, and render. This also works with video files.

OK cool, looks like you got it!

If you end up changing glDisplay over to videoOutput, there are other minor changes like that, but you can find the updated code in for it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.