编译openCV时出错

时间:2017-09-07 09:43:58

标签: c++ opencv ubuntu

我正在尝试编译一个基本的OpenCV程序,但有一些奇怪的错误。

$ g++ -o Read_and_write Read_and_write.cpp `pkg-config opencv --cflags 
--libs`
/usr/bin/ld: cannot find -lQt5OpenGL
/usr/bin/ld: cannot find -lQt5Concurrent
/usr/bin/ld: cannot find -lQt5Test
/usr/bin/ld: cannot find -lQt5Widgets
/usr/bin/ld: cannot find -lQt5Gui
/usr/bin/ld: cannot find -lQt5Core
collect2: error: ld returned 1 exit status

该计划如下所述。

#include </usr/include/opencv2/core/core.hpp>
#include </usr/include/opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main( )
{

       Mat image;

       // LOAD image
       image = imread("image1.jpg", CV_LOAD_IMAGE_COLOR);   // Read the file "image.jpg".
              //This file "image.jpg" should be in the project folder.
              //Else provide full address : "D:/images/image.jpg"

       if(! image.data )  // Check for invalid input
       {
              cout <<  "Could not open or find the image" << std::endl ;
              return -1;
       }

       //DISPLAY image
       namedWindow( "window", CV_WINDOW_AUTOSIZE ); // Create a window for display.
       imshow( "window", image ); // Show our image inside it.

       //SAVE image
       imwrite("result.jpg",image);// it will store the image in name "result.jpg"

       waitKey(0);                       // Wait for a keystroke in the window
       return 0;
}

我不明白为什么Qt会参与其中。我最近从系统中删除了conda。

更新: 我使用这些标志成功运行程序,但我仍然有疑问。

-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

0 个答案:

没有答案