close
try {
IplImage* gray = NULL;
IplImage* edge = NULL;
gray = cvCreateImage(cvSize(IMAGE_WIDTH,IMAGE_HEIGHT),IPL_DEPTH_8U,1);
edge = cvCreateImage(cvSize(IMAGE_WIDTH,IMAGE_HEIGHT),IPL_DEPTH_8U,1);
cvCvtColor(img,gray,CV_BGR2GRAY);
//邊緣檢測
cvCanny(gray,edge,30,100,3);
cvCvtColor(edge,img,CV_GRAY2BGR);
//保存结果
cvCopyImage(img,m_Ipl);
cvReleaseImage(&gray);
cvReleaseImage(&edge);
}
catch (cv::Exception& e) {
const char* err_msg = e.what();
//console輸出 std::cout << "exception caught: " << err_msg << std::endl;
CString a;
a+= err_msg;
AfxMessageBox(a); //MFC输出
}
全站熱搜
留言列表