OpenCV之一Hello, Lena!

#include <opencv/highgui.h>

#pragma comment( lib, "opencv_highgui243d.lib" )  
#pragma comment( lib, "opencv_core243d.lib" )  
#pragma comment( lib, "opencv_ml243d.lib" )  
#pragma comment( lib, "opencv_imgproc243d.lib" )  

int main( int argc, char** argv ) {
	IplImage* img = cvLoadImage( argv[1] );
	cvNamedWindow( "OpenCV", CV_WINDOW_AUTOSIZE );
	cvShowImage( "OpenCV", img );
	cvWaitKey(0);
	cvReleaseImage( &img );
	cvDestroyWindow( "OpenCV" );

	return ( 0 );
}

在项目-属性-命令行参数里设置需要显示的图片,如d:\lena.jpg

你可能感兴趣的:(OpenCV之一Hello, Lena!)