Bazziil
February 11, 2021, 10:10am
1
Hi everyone,
I want to use the visionworks algorithm sample object_tracker_nvxcu , i can launch it with custom .mp4 files with no issues, but i want it to work with the images from my camera.
My camera works with this Gstreamer pipeline :
gst-launch-1.0 v4l2src ! “video/x-raw, width=640, height=480, format=(string)YUY2” ! xvimagesink
Camera information
v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: ‘YUYV’
Name : YUYV 4:2:2
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 176x144
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 160x120
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1280x1024
Interval: Discrete 0.111s (9.000 fps)
Interval: Discrete 0.200s (5.000 fps)
I get the : Can’t open source URI device:///v4l2?index=0 Error, when i launch this command :
$./nvx_sample_object_tracker_nvxcu --source="device:///v4l2?index=0
I tried to change the gstreamer source code as suggested here , but it didn’t work.
Bazziil
February 12, 2021, 10:47am
2
Just noticed that in my previous post i said that i can’t launch .mp4 files with the samples. I totally can that was a mistake and i edited it.
I suspected the YUY2 format to be the problem so i tried to add the “videoconvert” element in the Gstreamer pipeline with :
GstElement * videoconvert = gst_element_factory_make(“videoconvert”, “csp”);
gst_element_link_many(color, sink, videoconvert, NULL);
It didn’t work.
I also noticed that my pipeline work with the xvimagesink element and doesn’t work with the appsink element (which is used in the library).
Switching the sink element from appsink to xvimagesink gives me one frame then close due to error.
I have the same issue on a NX development kit (Jetpack 4.4.1) and on a AN110-XNX (with Jetpack 4.5)
Please give me some advice as i can’t really think of other workaround
Hi,
VisionWorks doesn’t enable USB camera. Only CSI camera is supported.
But since it is open-sourced, you can add the support on your own:
Generally, you should get the v4l2 work with the suggestion in the topic 73905.
If not, could you share the modification details with us?
Thanks.
Bazziil
February 17, 2021, 8:22am
7
This was the instruction to modify the gstreamer code source :
This worked for me:
In file /nvxio/src/NVX/FrameSource/GStreamer/GStreamerCameraFrameSourceImpl.cpp
Change line 139
< stream << “video/x-raw, format=(string){ RGB }, width=[1,” << configuration.frameWidth <<
stream << "video/x-raw, format=(string){<b>YUY2</b>}, width=[1," << configuration.frameWidth <<
And add in line 217 your image output size
< std::string caps_string(“video/x-raw, format=(string){”);
std::string caps_string("video/x-raw, <b>width=(int){640}, height=(int){480},</b> format=(string){");
And also :
in my case I just updated the line :
< stream << “video/x-raw, format=(string){RGB}, width=[1,” << configuration.frameWidth <<
to
< stream << “video/x-raw, format=(string){YUY2}, width=[1,” << configuration.frameWidth <<
Not
stream << "video/x-raw, format=(string){<b>YUY2</b>}, width=[1," << configuration.frameWidth <<
i did not use the "</b>"
then compile the code and it works.
Well after retrying this I removed the “ ” in BOTH lines and it worked, so now i feel stupid. Thanks AastaLLL to make me recheck this.