⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex02.c

📁 OPENCV下的入门介绍以及配套源码
💻 C
字号:
/************************************************** * cvLoadImage, cvSaveImage, cvCreateImage, cvCopy以及图像显示的例子 **************************************************//*********************************************************************** * 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 "highgui.h"int main( int argc, char** argv ){  IplImage* pImg; //声明IplImage指针  //载入图像,强制转化为Gray  if( argc == 3 &&       (pImg = cvLoadImage( argv[1], 0)) != 0 )    {      IplImage* pImg2 = cvCreateImage(cvGetSize(pImg),				      pImg->depth,				      pImg->nChannels);      cvCopy(pImg, pImg2, NULL);      cvSaveImage(argv[2], pImg2);//把图像写入文件         cvNamedWindow( "Image", 1 );//创建窗口      cvShowImage( "Image", pImg );//显示图像            cvWaitKey(0); //等待按键	      cvDestroyWindow( "Image" );//销毁窗口      cvReleaseImage( &pImg ); //释放图像      return 0;    }  return -1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -