1
我使用与opencv CUDA 6.5,当我尝试编译这段代码imread(的std :: string常量和,INT)”:未定义的参考`CV :: OpenCV中
#include <opencv2/opencv.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <stdio.h>
using namespace cv;
int main() {
Mat src = imread("mini.jpg", 0);
if (!src.data) exit(1);
gpu::GpuMat d_src(src);
gpu::GpuMat d_dst;
gpu::bilateralFilter(d_src, d_dst, -1, 50, 7);
gpu::Canny(d_dst, d_dst, 35, 200, 3);
Mat dst(d_dst);
imwrite("out.png", dst);
return 0;
}
我得到了这些错误:
[email protected]:~/Templates/openCV$ nvcc gpu.cu `pkg-config --cflags
--libs opencv` /tmp/tmpxft_000016c6_00000000-16_gpu.o: In function `main': tmpxft_000016c6_00000000-3_gpu.cudafe1.cpp:(.text+0x63): undefined reference to `cv::imread(std::string const&, int)' tmpxft_000016c6_00000000-3_gpu.cudafe1.cpp:(.text+0x1bc): undefined reference to `cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)' collect2: error: ld returned 1 exit status
我怎么可以加它?!我尝试了不同的方式,但是它需要安装打包洞谢谢... –
您需要在您的系统上安装OpenCV才能使用它。 http://answers.opencv.org/question/25642/how-to-compile-basic-opencv-program-in-c-in-ubuntu/,另外你需要附加“-lopencv_imgcodecs”。 –
OpenCV 2.X如何? – imanzabet