/***********************************************************************
* OpenCV 2.0 測試例程
* 於仕琪 提供
***********************************************************************/
#include "stdafx.h"
#include "highgui.h"
//全部的以新風格命名的函數都在 cv 命名空間中
//若是但願不要每次都輸入 cv:: ,則可以使用下面語句
//using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
const char* p_w_picpathname = "lena.jpg";
cv::Mat img = cv::imread(p_w_picpathname); // Matlab風格的 cvLoadImage 函數的另外一種調用
if(img.empty())
{
fprintf(stderr, "Can not load p_w_picpath %s\n", p_w_picpathname);
return -1;
}
if( !img.data ) // 檢查是否正確載入圖像
return -1;
cv::namedWindow("p_w_picpath", CV_WINDOW_AUTOSIZE); //建立窗口
cv::imshow("p_w_picpath", img); //顯示圖像
cv::waitKey();
return 0;
}ide