- 论坛徽章:
- 0
|
2006-9-24
显示一幅图片
源代码:
//===========================================================
//cvtest.c
#include
#include
#include
int main( int argc, char **argv )
{
IplImage *src;
/* the first command line parameter must be image file name */
if ( argc == 2 && (src = cvLoadImage(argv[1], -1))!=0 )
{
cvNamedWindow( "src", CV_WINDOW_AUTOSIZE );
cvShowImage( "src", src );
cvWaitKey(-1);
cvDestroyWindow( "src" );
//void cvDestroyAllWindows(void);
}
return 0;
}
//===========================================================
编译:
# g++ `pkg-config --cflags opencv` -o cvtest cvtest.c `pkg-config --libs opencv`
运行:
把一幅图片test.jpg拷贝到cvtest所在的当前工作文件夹
#./cvtest test.jpg
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/13269/showart_175848.html |
|