Solving OpenCV GPU Image Stitching Error (SurfFeaturesFinderGpu)

HI Guys!

Two years since I posted something here. Everything seems new. WordPress has changed the back-end completely! Its fortunate to come back with something (probably!) useful for the community. Today’s one is very special and exclusive, in fact I feel I am relieved from a big pain.

In fact I was banging my head with the wonderfully crafted vaguely implied vague error happening inside somewhere in the OpenCV CUDA Built Binaries. In fact this issue is still open in OpenCV Github (

The Run Time Error Message was:

The function/feature is not implemented (You should explicitly call download method for cuda::GpuMat object) in cv::_InputArray::getMat_, file ~\opencv\modules\core\src\matrix.cpp, line 1276

However, the actual issue was in Line 483 of this file:


Basically, the original developer was trying to create a grayscale copy of one GpuMat into another GpuMat in the function cvtColor(). As you know this function receives Mat as input, there is a mismatch in the typecast. There is no default Mat(GpuMat) cast. So, when you try to use Extended Features 2D module and GPU computing, you can not use the Gpu Version of the Feature Finder.

I changed the line:

cvtColor(image_, gray_image_, COLOR_BGR2GRAY);

Firstly, I took one temporary Mat and put the gray-scale copy  in it. Then I uploaded it on GPU memory:

cvtColor(image, gray_image, COLOR_BGR2GRAY); //CREATE THE GRAY IMAGE
gray_image_.upload(gray_image); //SEND THE GRAY IMAGE TO GPU COUNTERPART

And built OpenCV again. The Issue was there no more. Hope this helps!

I am planning to come up with another post on how painfully I built the CUDA Enabled Binaries properly and enjoying now ! 🙂 See you then.


3 thoughts on “Solving OpenCV GPU Image Stitching Error (SurfFeaturesFinderGpu)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s