It's really a toss-up.
Event background: For an optical flow extraction process, Originally 3.1 OpenCV in include some modules error, because opencv3.0 above version of the module is re-separated, to contribute, but contribute still can't solve, so, chose 2.4.11 (because before Windows used, know which letters Number of possible calls).
At this point there is a problem similar to NVCC warning: and then follow (http://blog.csdn.net/wang4959520/article/details/51392804) or add the parameter-D to the CMake Build_opencv_gpu=off, thought can succeed, but have error: ' Nppigraphcutstate ' similar error, at this time, find http://blog.csdn.net/caozhantao/article/ details/51479172 this blog, according to its saying, uninstall 2.4.11, switch to 2.4.13, in CMake, with the
cmake-d cmake_build_type=release-d build_opencv_gpu=off-d cmake_install_prefix=/usr/local.
This has been successfully compiled and passed, and nonfree and other header files can also include the success.
But in the call GPU header file when the error said there is no # include <opencv2/gpu/gpu.hpp>, OK, can only recompile, and follow http://www.cnblogs.com/CarryPotMan/p/ 5377921.html this blog again to 2.3.13 compile again, still did not solve.
Finally thought may be cuda does not support, decided to unload 2.4.12, with 2.4.12, or press this blog, compile, or not, well, combined with the http://blog.csdn.net/xuezhisdc/article/details/ 48691797 and http://blog.csdn.net/allyli0022/article/details/62859290 came, used:
cmake_install_prefix=/usr/local-d with_cuda=on-d with_tbb=on-d build_new_python_support=on-d with_v4l=on-d INSTALL_ c_examples=on-d install_python_examples=on-d build_examples=on-d with_qt=on-d with_opengl=on-d enable_fast_math=1-d cuda_fast_math=1-d with_cublas=1-d cuda_generation=Fermi .
And will be graphcuts.cpp in
Will #if!defined (Have_cuda) | | Defined (Cuda_disabler)
Switch
#if!defined (Have_cuda) | | Defined (Cuda_disabler) | | (cudart_version >= 8000)
Finally, the problem of GPU module invocation is solved.
Ubuntu install OPENCV for calling GPU modules