Get start with OpenCV

Get start with OpenCV


            花了三天的时间才把OpenCV装好~这个过程简直艰辛。。。昨天晚上我都差点要绝望了,心里难受啊~最后不知道尝试了多少次之后,libgtk2.0-dev终于装上去了.


          apt-get 之前一直找不到libgtk2.0-dev 这个包,无比纠结,时间都砸进去了。仅仅只是搭建开发环境而已,却花了这么多时间,心疼啊~我仅剩不多的暑假时光~如果有viewer和我遇到同样的问题,那我建议——重装一次你的Ubuntu吧~


编译遇到点小麻烦,不过搞定也花什么时间。


Get start with OpenCV, the first demo.


/************************************************************
code writer : EOF
code date : 2014.08.04
e-mail  : jasonleaster@gmail.com jasonleaster@163.com
code purpose:
	This demo is coded for someone who is the first time 
to code with OpenCV (A very powerful computer vision library.)
Something like your "Hello world" is here.

************************************************************/

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/highgui/highgui_c.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"

int main(int argc,char* argv[])
{
	IplImage* img = cvLoadImage(argv[1],CV_LOAD_IMAGE_COLOR);
	//IplImage is a structure which could store a image that retured by function 'cvLoadImage'

	cvNamedWindow("Example1",CV_WINDOW_AUTOSIZE);
	//cvNamedWindow is a function which would help you to creat a window.

	cvShowImage("Example1",img);
	//Obviously, show the picture that you inputed.

	cvWaitKey(0);
	//pause and let the user see the picture.

	cvReleaseImage(&img);
	//Finally, release the struture, otherwise, memory leak !

	return 0;
}



没完,编译的参数看的库自带的demo的脚本,不难。这里给出能用的简单的脚本,在当前工作目录下运行即可


#!/bin/sh

for i in *.c; do
    echo "compiling $i"
    gcc -ggdb `pkg-config --cflags opencv` -o `basename $i .c` $i `pkg-config --libs opencv`;
done







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值