Gstreamer plugin using opencv GPU


I am trying to perform template matching using the GPU accelerated methods provided by opencv.However, I am trying to write this as a plugin for gstreamer. So far I have managed to write a plugin that uses some opecv methods but I have trouble accessing the gpu accelerated methods. Is there a way to use these c++ gpu methods within a gstreamer plugin or is this a dead end? Is anyone aware of an example on how to do this? Thanks in advance.

Have you installed OpenCV4Tegra? What “trouble” are you having? Compile-time? Link-time? Run-time?

Adding a gstreamer plugin is not impossible but it’s not simple either.


I have installed opencv4tegra and I have managed to do some image processing(gray image extraction) using opencv functions written in c, inside a gstreamer plugin. However, what I want to use is the PyrLKOpticalFlow object available in the gpu library. But since this is c++ its not straight forward how to use it inside a gstreamer plugin. I would prefer not to use gstreamermm. Is there a way to call the cv::GPU opencv objects such as gpu::GpuMat or gpu::PyrLKOpticalFlow from within a plugin? Thanks in advance.

You can compile your code as C++, thus using cv::gpu module objects, but then export the symbols as ‘extern “C”’ (not classes) so that Gstreamer can access them. Some C++ features may have to be turned off or the cv compiled into a separate shared object so that things like the exception handling aren’t in the gstreamer modules.