?? canny.c
字號:
/************************************************** * cvCanny:Canny邊緣檢測 **************************************************//*********************************************************************** * OpenCV example * Copyright (C) 2006 Shiqi Yu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***********************************************************************/#include "cv.h"#include "cxcore.h"#include "highgui.h"int main( int argc, char** argv ){ //聲明IplImage指針 IplImage* pImg = NULL; IplImage* pCannyImg = NULL; //載入圖像,強制轉化為Gray if( argc == 2 && (pImg = cvLoadImage( argv[1], 0)) != 0 ) { //為canny邊緣圖像申請空間 pCannyImg = cvCreateImage(cvGetSize(pImg), IPL_DEPTH_8U, 1); //canny邊緣檢測 cvCanny(pImg, pCannyImg, 50, 150, 3); //創建窗口 cvNamedWindow("src", 1); cvNamedWindow("canny",1); //顯示圖像 cvShowImage( "src", pImg ); cvShowImage( "canny", pCannyImg ); cvWaitKey(0); //等待按鍵 //銷毀窗口 cvDestroyWindow( "src" ); cvDestroyWindow( "canny" ); //釋放圖像 cvReleaseImage( &pImg ); cvReleaseImage( &pCannyImg ); return 0; } return -1;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -