I am trying to install the cuda toolkit so I can use the gpu functions in opencv. I've read all the documentation and the getting started guide with windows. I've downloaded the CUDA 6.5 toolkit, and installed it. I tried running this sample code:
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"
int main (int argc, char* argv[])
{
try
{
cv::Mat src_host = cv::imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);
cv::gpu::GpuMat dst, src;
src.upload(src_host);
cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);
cv::Mat result_host = dst;
cv::imshow("Result", result_host);
cv::waitKey();
}
catch(const cv::Exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
}
return 0;
}
however I get linker errors. A little digging led me to this question, recommending to include the C:\opencv\build\gpu\x86...libraries and binaries. My problem is that the gpu folder does not exist in my opencv install folder.
A little more digging and I found this suggesting the use of CMake. But it also requires the SDK! First of all, there is no mention of the SDK on the nvidia website. It doesnt exist in their downloads page. So I ignored that part and followed the steps listed, CMake could not find any of the CUDA directories (despite them being installed in the default locations). I located them manually, generated the opencv solution then built that in visual studio. This has now been 'building' for a few hours (VS says ready however).
What is the point of building the openCV solution it generated? How do I get the gpu folder for openCV.