1 | initial version |
It seems that in order to get the cuda functionality working you need to explicitly include the CUDA header of that function. This setup did it just fine on my system
#include <opencv2/opencv.hpp>
#include <opencv2/cuda.hpp>
#include <opencv2/cudaimgproc.hpp>
using namespace cv;
int main() {
Mat src = imread("car1080.jpg", 0);
if (!src.data) exit(1);
cuda::GpuMat d_src(src);
cuda::GpuMat d_dst;
cuda::bilateralFilter(d_src, d_dst, -1, 50, 7);
cv::Canny(d_dst, d_dst, 35, 200, 3);
Mat dst(d_dst);
imwrite("out.png", dst);
return 0;
}
2 | No.2 Revision |
It seems that in order to get the cuda functionality working you need to explicitly include the CUDA header of that function. This setup did it just fine on my system
UPDATE
Adapted and working code --> Verified
#include <opencv2/opencv.hpp>
#include <opencv2/cuda.hpp>
#include <opencv2/cudaimgproc.hpp>
using namespace cv;
int main() {
Mat src = imread("car1080.jpg", imread("/home/spu/Desktop/test.jpg", 0);
if (!src.data) exit(1);
cuda::GpuMat d_src(src);
cuda::GpuMat d_dst;
cuda::bilateralFilter(d_src, d_dst, -1, 50, 7);
cv::Canny(d_dst, d_dst, Mat dst;
d_dst.download(dst);
cv::Canny(dst, dst, 35, 200, 3);
Mat dst(d_dst);
imwrite("out.png", dst);
resize(dst, dst, Size(dst.cols/3, dst.rows/3));
imshow("test", dst); waitKey(0);
return 0;
}
And the result as seen below