I have an existing web camera app that I’m trying to port over to the Jetson Nano. This is a large app that uses OpenCV (cv::imdecode, cv::imwrite, etc.) extensively.
To display the web camera, the app uses OpenGL. The web camera outputs video in MJPEG. To display in OpenGL, the app first has to decode the MJPEG stream before sending to OpenGL for rendering.
I want to speed up this decoding step by using NvJPEGDecode. However, based on posts such as these:
…it looks like it is not possible to use NvJPEGDecoder and OpenCV in the same app. Is this correct?
To test this, I created a small test program that calls cv::imdecode. It works correctly at first.
But if I add NvJPEGDecoder in the same program, it fails.
If I only link to nvjpeg, then the test program segfaults when it calls cv::imdecode.
If I link to nvjpeg and instantiate NvJPEGDecoder, it doesn’t segfault, but the cv::Mat returned by cv::imdecode doesn’t contain data (cv::Mat::data is null), so it fails in a different way.
So this seems to indicate that it’s not possible to use OpenCV and NvJPEGDecoder in the same program. Is this accurate?
Hi,
It is known that NvJPEGDecoder does not work in OpenCV. Please use jpeg decoder in OpenCV, or run gstreamer string with nvv4l2decoder mjpeg=1 in cv2.VideoCapture().