安装OpenCV库
运行如下命令:sudo apt-get install libcv-dev libcvaux-dev libhighgui-dev
test.c测试程序
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
IplImage *src=cvLoadImage("/media/Documents/Picture/Sample/Lena.bmp",1);
cvNamedWindow("Lena",1);
cvShowImage("Lena",src);
cvWaitKey(0);
cvReleaseImage(&src);
cvDestroyWindow("Lena");
return 0;
}
然后,在终端里面切换到文件所在的目录。比如,我将上面的文件保存为test.c的话,可以使用如下命令来测试:g++ `pkg-config opencv --libs --cflags opencv` test.c -o test
运行如下命令:sudo apt-get install libcv-dev libcvaux-dev libhighgui-dev
test.c测试程序
#include <highgui.h>
#include <cv.h>
#include <cxcore.h>
int main()
{
IplImage *src=cvLoadImage("/media/Documents/Picture/Sample/Lena.bmp",1);
cvNamedWindow("Lena",1);
cvShowImage("Lena",src);
cvWaitKey(0);
cvReleaseImage(&src);
cvDestroyWindow("Lena");
return 0;
}
然后,在终端里面切换到文件所在的目录。比如,我将上面的文件保存为test.c的话,可以使用如下命令来测试:g++ `pkg-config opencv --libs --cflags opencv` test.c -o test