?
演示:读入一张图片,并显示
?
- #include?"stdafx.h"??
- #include?<opencv2/core/core.hpp>??
- #include?<opencv2/contrib/contrib.hpp>??
- #include?<opencv2/highgui/highgui.hpp>??
- #include?<opencv2/imgproc/imgproc.hpp>??
- #include?<opencv2/objdetect/objdetect.hpp>??
- ??
? - using?namespace?cv;??
- using?namespace?std;??
- #pragma?comment(linker,?"/subsystem:\"windows\"?/entry:\"mainCRTStartup\"")???
- int?main(int?argc,?char**?argv[])??
- {??
- ????//加载图像文件?
- ????IplImage*?img?=?cvLoadImage("F:\\life\\大悲集\\580360_4.jpg");??
- ??
? - ????//显示窗口
- ????cvNamedWindow("Pusa",?CV_WINDOW_AUTOSIZE);??
- ??
? - ????//显示图像
- ????cvShowImage("Pusa",?img);??
- ??
? - ????//等待任意键
- ????cvWaitKey(0);??
- ??
? - ????//释放图像
- ????cvReleaseImage(&img);??
- ????//销毁窗口
- ????cvDestroyWindow("Pusa");??
- ??
? - ????return?0;??
- }??
?
时间: 2025-01-04 05:37:04