debian下OpenCV安装 + 简单测试实例

1、更新下载更新软件包列表信息


sudo apt-get update


2、查询OpenCV相关软件

wangye@debian:~/Opencv_study$ apt-cache search opencv
libcv-dev - development files for libcv
libcv2.1 - computer vision library
libcvaux-dev - development files for libcvaux
libcvaux2.1 - computer vision extension library
libhighgui-dev - development files for libhighgui
libhighgui2.1 - computer vision GUI library
opencv-doc - OpenCV documentation and examples
python-opencv - Python bindings for the computer vision library

wangye@debian:~/Opencv_study$


3、安装相关软件包

如果只是用来运行OpenCV程序,仅需安装libcv2.1,libcvaux2.1,libhighgui2.1

如果你要使用OpenCV来编写程序,那么还需要安装libcv-dev,libcvaux-dev,libhighgui-dev包

文档在opencv-doc包中,python-opencv是OpenCV的Python语言包,可根据需要安装:

wangye@debian:~/Opencv_study$ sudo  apt-get install libcv-dev libcvaux-dev libhighgui-dev libcv2.1 libcvaux2.1 libhighgui2.1 python-opencv opencv-doc

4、测试安装包

测试是否安装成功,你可以使用以下的命令行编译位于源代码包中的 opencv_test.c例子:

wangye@debian:~/Opencv_study$ vim opencv_test.c
#include "cv.h"
#include "highgui.h"

int main (int argc,char **argv)
{
    IplImage *pImg;
    pImg = cvLoadImage ("Fruits.jpg",1);
    cvNamedWindow ("Image",1);
    cvShowImage ("Image", pImg);
    cvWaitKey (0);
    cvDestroyWindow ("Image");
    cvReleaseImage (&pImg);
    return 0;
}

wangye@debian:~/Opencv_study$ g++ opencv_test.c `pkg-config opencv --libs --cflags opencv` -o drawing //生成目标文件drawing 

wangye@debian:~/Opencv_study$ ls
drawing  Fruits.jpg  opencv_test.c  opencv_test.c~
wangye@debian:~/Opencv_study$ ./drawing 

结果如下:



参考:

http://wiki.opencv.org.cn/index.php/Debian


阅读更多
个人分类: OPenCV学习
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

debian下OpenCV安装 + 简单测试实例

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭