我已经用WITH_CUDA=on
成功构建了opencv。但我仍然遇到此错误error: namespace "cv::cuda" has no member "resize"
。 IDE建议我在该命名空间中有一个resize函数,但是编译失败,这很奇怪。有谁知道如何解决这个问题?
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/video/background_segm.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/cudev/ptr2d/gpumat.hpp"
#include "opencv2/cudev/ptr2d/resize.hpp"
#include "newfile.h"
using namespace cv;
using namespace std;
int test() {
cv::Mat LoadedImage;
cv::cuda::GpuMat Im;
LoadedImage = imread("in.jpg", IMREAD_COLOR);
Im.upload(LoadedImage);
cv::cuda::resize(LoadedImage, LoadedImage, cv::Size(), 0.5, 0.5, cv::INTER_NEAREST);
imwrite("Step4a.JPG", LoadedImage);
return 0;
}
答案 0 :(得分:0)
正如@john指出的那样。我应该#include <opencv2/cudawarping.hpp>
来解决问题。