Now I need to convert this into Opencv Pipeline. I tried but I always get the following error:
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (711) open OpenCV | GStreamer warning: Error opening bin: could not parse caps “video/x-raw, , format=(string)GRAY8”
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
libpng warning: Image width is zero in IHDR
libpng warning: Image height is zero in IHDR
libpng error: Invalid IHDR data
This is the pipeline I’m trying to run. I know openCV requires BGR format so,
The pipeline string should not have further quoting than start and end. Extra quoting is only required with gst-launch from shell when parenthesis are used.
The image scaling with CPU is not done by videoconvert but by videoscale. So your pipeline would be:
Your current pipeline converts many pixels into BGR before scaling into lower resolution. You may save some CPU load scaling first and converting with a lower number of pixels.
You would save even more CPU load with my second pipeline leveraging HW scaling and conversion.
Hi @Honey_Patouceul ,
I tried to use the pipeline. But when I capture a frame, there is always a delay. I tried to even restrict the buffer to maximum 1 but still, there is a delay in capturing the latest frame. Here is the pipeline which I’m using at the moment
You may tell what is your use case for better advice. Opencv doesn’t require BGR, it can also accept GRAY8 frames. Depends on what opencv algorithms you intend to use. But since all info is in monochrome, if the algorithms you want to use are available for monochrome in opencv, this would be the best solution.
Also try to add option io-mode=2 to your v4l2src plugin, it may help in some cases;
Its just I’m doing a feature detection in the monochrome. In OpenCV I’m just using findcontour function to detect contour in the image. I think I can directly pass GRAY8 format to OpenCV. That might remove the delay in capturing the frame.