I couldn’t find a simple example of CMakeLists to compile my very first program using Opencv GPU like this:
using namespace cv;
Mat image = imread("file.png");
gpu::threshold(image_gpu, result, 128, CV_THRESH_BINARY);
Can anyone suggest me a CMakeLists file with/without CUDA… please
and if you’ve any interesting tutorials to start with opencv gpu (mostly for compilation cmake…etc) would be great
Are you trying to compile this on the TX2? If so, the gpu:: libraries will not work if you’re using Opencv4Tegra right now. There was a compilation mistake which makes the gpu:: libraries unusable. The next update should have this fixed.
If you’ve build opencv from source, then a CMakeLists.txt file with contents similar to this should work!
You can find some OpenCV w/ CUDA and OpenCV w/o CUDA code on my GitHub page (ex: https://github.com/ShreyasSkandan/nvidia-tx1-tx2/tree/master/opencv_stuff/optical-flow)
Hope that answers your questions.
Yes I’m using TX2 and yes Opencv4Tegra is the one installed… So do you say that I can’t use opencv gpu functions ? shoud I install another version of opencv from source?
I can compile all my codes using opencv cpu. Now I want to move to gpu so I started with simple code (posted above in my question) but it doesn’t work with my cmakelistes nor with yours.
I checked your GitHub but it doesn’t have any code with GPU all with opencv cpu in which I don’t have any issues…
You can find more information regarding the problems with the gpu:: functions and Opencv4Tegra here:
You are advised to build from source if you wish to use the gpu:: functions immediately,
Yes, my GitHub code lacks any gpu:: functions because I’d rather not build from source at this point and lose some of the SIMT optimizations that Opencv4Tegra has.
Okay thanks for the links… the issue was posted the first time on 03/18/2017 so it is months ago and we don’t know when it will be fixed. I prefer to build from source for now.
Do you think that the same CMakeLists you gave me or that I use normally for CPU should work with gpu:: library?
Yup, it should/does work. I’ve tried the gpu:: libraries with the older Opencv4Tegra on the TX1 and it works!
I uninstalled OpenCV4Tegra from TX2 and installed the new version of OpenCv from source and it works (the gpu lib).
Hai, Can i ask u something bro?
When i run comand “cmake .”
I get this error.
Please help me.
I use ubuntu 16.04, cuda-8.0, opencv3.1
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find CUDA: Found unsuitable version “7.5”, but required is exact
version “8.0” (found /usr)
Call Stack (most recent call first):
– Configuring incomplete, errors occurred!
See also “/home/panjaitan/Documents/HoughLine/CMakeFiles/CMakeOutput.log”.
See also “/home/panjaitan/Documents/HoughLine/CMakeFiles/CMakeError.log”.