无法打开包含文件: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();
}