opencv 源文件:https://opencv.org/opencv-3-3.html
安装步骤:
- sudo apt-get install build-essential
- sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
- sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
- tar zxf opencv.tar.gz and cd opencv
- mkdir build and cd build
- cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ../
- sudo make
- make install
测试用例:
#include <iostream>
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main(int argc,char *argv[])
{
Mat image;
image = imread("./lena.bmp",1);
if( ! image.data)
{
cout<< "No image data" << endl;
return -1;
}
namedWindow("Diaplay Image",WINDOW_AUTOSIZE);
imshow("Display Image",image);
waitKey(0);
return 0;
}
编译命令:
g++ -g lena.cpp -o lena `pkg-config` --cflags --libs opencv`
./lena
原文链接:https://www.f2er.com/ubuntu/350478.html