感谢支持
我们一直在努力

OpenCV in Ubuntu 10.04

1. 安装opencv libraries.


sudo apt-get install libcv libcv-dev libcvaux libcvaux-dev libhighgui libhighgui-dev opencv-doc Python-opencv


2.安装完后,输入:


export LD_LIBRARY_PATH=/home/opencv/lib
export PKG_CONFIG_PATH=/home/opencv/lib/pkgconfig
都是opencv的默认路径


3. 检测OpenCV library的目录:


$ pkg-config –cflags opencv
(输出:-I/usr/include/opencv)


$ pkg-config –libs opencv
(输出:-lcxcore -lcv -lhighgui -lcvaux -lml)


4. 检测是否所有的Library文件都安装好了:


$ apt-cache search opencv
显示如下:


OpenCV in Ubuntu 10.04



5. 显示图片的示例程序:


#include “highgui.h”


int main( int argc, char** argv )
{
IplImage* img = cvLoadImage( “lena512.bmp” );
cvNamedWindow( “E1″, CV_WINDOW_AUTOSIZE );
cvShowImage( “E1″, img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( “E1″ );
}


把lena512.bmp换成你要显示的图片文件。


6. 编译


g++ -I/usr/include/opencv -o e1 -lcv -lcxcore -lhighgui -lm e1.cpp


7. 运行


./e1
显示Lena


OpenCV in Ubuntu 10.04

赞(0) 打赏
转载请注明出处:服务器评测 » OpenCV in Ubuntu 10.04
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏