How to display detect result in OpenGL window

Hi Sir,

I am using Jeston Inference for object detection by @dusty_nv,It’s easy to display the ruslut in OpenGL window by using default command
:$ decectnet /usr/share/visionworks/sources/data/pedestrians.mp4

or follow the jetson-inference/detectnet-example-2.md at master · dusty-nv/jetson-inference · GitHub using CSI camera as videosouce ,the reults can aslo be displayed in the windows.

But I want to try some diferent ,using mp4 file as input source,but the result cannot show in the OpenGL window,where does it neeed to be adjusted?

Here is my basic code:

import jetson.inference
import jetson.utils

net = jetson.inference.detectNet(“ssd-mobilenet-v2”, threshold=0.3)

input = jetson.utils.videoSource(“file:///usr/share/visionworks/sources/data/pedestrians.mp4”)

output = jetson.utils.videoOutput(“display://0”)

while True:
img = input.Capture()
detections = net.Detect(img)
output.Render(img)

Please help.
Thank you!

Hi @Bigmao, hmm I do not immediately see the issue in your code. Since detectnet program works for you, I would start by modifying the source of detectnet.py and going from there.

1 Like

Not sure at all, but you may try to create the output before the source:

output = jetson.utils.videoOutput(“display://0”)
net = jetson.inference.detectNet(“ssd-mobilenet-v2”, threshold=0.3)
input = jetson.utils.videoSource(“file:///usr/share/visionworks/sources/data/pedestrians.mp4”)
1 Like

Amazing,It works!
thank you so much sir!