OpenCV加载图像并显示

从文件中读取一直一张图片,并加载出来

代码:

#include "stdafx.h"
#include "iostream"
using namespace std;
#include "opencv2/opencv.hpp" int main()
{
const char *pImagePath = "E:/C_VC_code/Text_Photo/girl001.jpg";
const char *pWindowsTitle = "MyFirst OpenCV"; //load image from file
IplImage *pImage = cvLoadImage(pImagePath,CV_LOAD_IMAGE_UNCHANGED); //create window
cvNamedWindow(pWindowsTitle,CV_WINDOW_AUTOSIZE); //show image on window
cvShowImage(pWindowsTitle,pImage); //wait key event
cvWaitKey(); cvDestroyWindow(pWindowsTitle);
cvReleaseImage(&pImage);
return ;
}

结果展示:

OpenCV加载图像并显示

上一篇:零基础入门学习Python(13)--元组:戴上了枷锁的列表


下一篇:攒机I7