jetson-inference icon indicating copy to clipboard operation
jetson-inference copied to clipboard

The Imaging Source Camera

Open Ukhupacha opened this issue 2 years ago • 3 comments

Hello,

I'm using a specific industrial camera that I connect by USB. Sadly, V4l2 is not working with this camera. https://github.com/TheImagingSource/tiscamera, this is the repo from the camera.

Could anybody give me some guidance on what to change in order to make v4l2 work with this camera?

I've been digging into the https://github.com/dusty-nv/jetson-utils/blob/master/camera/gstCamera.cpp file in order to make it work but I'm a bit loss. These are the formats of the camera.

video/x-bayer rggb - 640x480 - 1/1 5/1 15/1 30/1 60/1 120/1 5000000/20833 480/1 601/1 video/x-bayer rggb - 1440x1080 - 1/1 5/1 15/1 30/1 60/1 120/1 2500000/10593 video/x-raw BGRx - 640x480 - 1/1 5/1 15/1 30/1 60/1 120/1 5000000/20833 480/1 601/1 video/x-raw BGRx - 1440x1080 - 1/1 5/1 15/1 30/1 60/1 120/1 2500000/10593

This is the error I get

ukhu@cuy:~$ detectnet /dev/video1 [gstreamer] initialized gstreamer, version 1.14.5.0 [gstreamer] gstCamera -- attempting to create device v4l2:///dev/video1

(detectnet:30887): GStreamer-CRITICAL **: 01:51:01.364: gst_element_message_full_with_details: assertion 'GST_IS_ELEMENT (element)' failed

(detectnet:30887): GStreamer-CRITICAL **: 01:51:01.364: gst_element_message_full_with_details: assertion 'GST_IS_ELEMENT (element)' failed

(detectnet:30887): GStreamer-CRITICAL **: 01:51:01.365: gst_element_message_full_with_details: assertion 'GST_IS_ELEMENT (element)' failed [gstreamer] gstCamera -- found v4l2 device: DFK 33UX273 [gstreamer] v4l2-proplist, device.path=(string)/dev/video1, udev-probed=(boolean)false, device.api=(string)v4l2, v4l2.device.driver=(string)uvcvideo, v4l2.device.card=(string)"DFK\ 33UX273", v4l2.device.bus_info=(string)usb-70090000.xusb-1.1, v4l2.device.version=(uint)264701, v4l2.device.capabilities=(uint)2216689665, v4l2.device.device_caps=(uint)69206017; [gstreamer] gstCamera -- found 6 caps for v4l2 device /dev/video1 [gstreamer] [0] video/x-raw, format=(string)YUY2, width=(int)1440, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 120/1, 60/1, 30/1, 15/1, 5/1, 1/1 }; [gstreamer] [1] video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 596/1, 480/1, 5000000/20833, 120/1, 60/1, 30/1, 15/1, 5/1, 1/1 }; [gstreamer] [2] video/x-raw, format=(string)BGR, width=(int)1440, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 80/1, 60/1, 30/1, 15/1, 5/1, 1/1 }; [gstreamer] [3] video/x-raw, format=(string)BGR, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 398/1, 5000000/20833, 120/1, 60/1, 30/1, 15/1, 5/1, 1/1 }; [gstreamer] [4] video/x-bayer, format=(string)rggb, width=(int)1440, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 2500000/10593, 120/1, 60/1, 30/1, 15/1, 5/1, 1/1 }; [gstreamer] [5] video/x-bayer, format=(string)rggb, width=(int)640, height=(int)480, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction){ 601/1, 480/1, 5000000/20833, 120/1, 60/1, 30/1, 15/1, 5/1, 1/1 }; [gstreamer] gstCamera -- selected device profile: codec=raw format=bayer-rggb width=1440 height=1080 [gstreamer] gstCamera pipeline string: [gstreamer] v4l2src device=/dev/video1 do-timestamp=true ! video/x-raw, format=(string)rggb, width=(int)1440, height=(int)1080 ! appsink name=mysink [gstreamer] gstCamera failed to create pipeline [gstreamer] (could not link v4l2src0 to mysink, v4l2src0 can't handle caps video/x-raw, format=(string)rggb, width=(int)1440, height=(int)1080) [gstreamer] gstCamera -- failed to create device v4l2:///dev/video1 detectnet: failed to create input stream

I would appreciate some advice.

Ukhupacha avatar Aug 22 '22 04:08 Ukhupacha

Hi @Ukhupacha, are you able to view your camera through other V4L2 applications or standalone GStreamer pipelines, or is the issue specific to using programs from jetson-inference/jetson-utils?

[gstreamer] gstCamera -- selected device profile: codec=raw format=bayer-rggb width=1440 height=1080
[gstreamer] gstCamera pipeline string:
[gstreamer] v4l2src device=/dev/video1 do-timestamp=true ! video/x-raw, format=(string)rggb, width=(int)1440, height=(int)1080 ! appsink name=mysink

This should be a valid pipeline based on your device caps, however it fails to create the pipeline, which makes me think something else is going on in gstreamer or the camera's driver.

dusty-nv avatar Aug 22 '22 15:08 dusty-nv

@dusty-nv, I'm able to view the camera with the driver they provide that uses V4L2. Screenshot from 2022-08-22 10-53-52

I can also use the gstreamer to view the camera feed with this: https://github.com/TheImagingSource/tiscamera/blob/master/examples/python/03-live-stream.py

gst-launch-1.0 tcambin ! videoconvert ! ximagesink sync=false

Ukhupacha avatar Aug 22 '22 16:08 Ukhupacha

gst-launch-1.0 tcambin ! videoconvert ! ximagesink sync=false

That doesn't appear to use the v4l2src element, instead it uses their own custom tcambin element

You could try modifying jetson-utils to use it too: https://github.com/dusty-nv/jetson-utils/blob/445c83a2193167d15cfaf6ffb1e620b600be383c/camera/gstCamera.cpp#L166

dusty-nv avatar Aug 22 '22 17:08 dusty-nv