标签:space uil 技术分享 编译 代码 imu src std images
cd ~/opencv-3.0.0-rc1
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install
mkdir ~/opencv-test
cd ~/opencv-test
gedit DisplayImage.cpp
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
}
Mat image;
image = imread( argv[1], 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
gedit CMakeLists.txt
写入如下内容
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
cd ~/opencv-test
cmake .
make
此时opencv-lena文件夹中已经产生了可执行文件DisplayImage,下载lena.jpg放在opencv-test下,运行
./DisplayImage test.jpg
可直接使用apt安装
sudo apt-get install python-opencv
sudo apt-get install python-numpy
测试:
打开python,import cv模块成功即可。
import cv
ubuntu下opencv 3.0和python2.7安装测试
标签:space uil 技术分享 编译 代码 imu src std images
原文地址:http://www.cnblogs.com/whowhoha/p/6193064.html