ofx and opencv gpu inconsistent "OpenCV Error: No GPU support" exception.

Hello all,

I’m new to ofx, but have been working on a opencv program that uses quite a few calls to the gpu accelerated functions. I’m working on integrating that code into ofx.

I’ve moved my code into a new class (in segmenter.h), and changed the makefile to compile with opencv and opencv gpu. I’ve confirmed my old opencv code works fine on this machine (opencv is compiled and installed with GPU support).

The problem is that some opencv::gpu calls work fine (like uploading textures, and colorspace conversion), but some calls don’t work at all (like gpu::morphologyEx), in fact I get a very strange error when running compiled code with morphologyEx:

OpenCV Error: No GPU support (The library is compiled without GPU support) in throw_nogpu, file /home/arturo/Downloads/OpenCV-2.3.1/modules/gpu/precomp.hpp, line 99
terminate called after throwing an instance of ‘cv::Exception’
what(): /home/arturo/Downloads/OpenCV-2.3.1/modules/gpu/precomp.hpp:99: error: (-216) The library is compiled without GPU support in function throw_nogpu

Which only happens with morphologyEx, and does not happen when other functions (such as gpu::blur).

I can’t explain this inconsistency.

Attached is a simplified version of the project, including makefiles.
Tested on Linux (Ubuntu Precise) with ofx 0071, OpenCV 2.4.2 and CUDA 4.2

Any help appreciated.

DM.zip

Seems the problem was unwittingly having ofxOpenCv in my addons.make (copied from ofxCv).

Removing it seems to have solved the problem. I’m expecting to use only ofxCv, so I hope removing this will not cause issues down the line… drawMat() seems to work anyhow…

A version of drawMat that draws gpuMats would be really nice…