CUDA 7.5与visual studio 2013和open cv 3.0.0 .errors同时构建cuda代码

时间:2016-06-04 07:33:12

标签: c++ gpu

  

无法打开包含文件:opencv2 / cudafilters.hpp:没有这样的文件或目录

我在尝试构建以下代码时遇到此错误 ConsoleApplication71.cpp:定义控制台应用程序的入口点。

#include "stdafx.h"


#include "opencv2/opencv.hpp"
#include "opencv2/cudafilters.hpp"
#include "opencv2/cudaimgproc.hpp"
using namespace std;
using namespace cv;
using namespace cv::cuda;

//-----------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------
int main(int argc, char** argv)
{
cv::cuda::setDevice(0);
// -------------------------------
// 
// -------------------------------
Mat img = imread("test.png", 0);
int erosionDilation_size = 5;
Mat element = cv::getStructuringElement(MORPH_RECT, Size(2 * erosionDilation_size + 1, 2 * erosionDilation_size + 1));

cuda::GpuMat d_element(element);
cuda::GpuMat d_img(img);

Ptr<cuda::Filter> dilateFilter = cuda::createMorphologyFilter(MORPH_DILATE, d_img.type(), element);
dilateFilter->apply(d_img, d_img);


d_img.download(img);

d_img.release();
d_element.release();

imshow("test", img);
waitKey();
}

0 个答案:

没有答案