需要在Ubuntu 16.04下的apt-get安装的OpenCV 2.4.3.1中设置哪个标志来获取imread?

时间:2017-07-27 12:58:44

标签: c++ opencv ubuntu makefile

我已使用命令sudo apt-get install libopencv-dev python-opencv安装了OpenCV。现在我想编写一个简单的代码来读取图像文件,

基本上它看起来像这样:

#include <opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>

int main(void){

        cv::Mat image;
        image = cv::imread("test.png");
}

我将以下行放入Makefile

LIBRARIES :=  -lopencv_core -lopencv_imgproc 

我在Opencv中读到了&gt; 3必须添加-lopencv_imgcodec,但我在版本2.4,当我尝试这个标志时,它找不到。

我当前的错误说明如下:

 undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)

我也尝试使用pkg-config --cflags opencv选项作为libs,然而我在Linux下得到了众所周知的libtiff4.0错误。

0 个答案:

没有答案