代码如下:
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "math.h"
int main(int argc, char* argv[]))
{ IplImage *src = 0;
IplImage *dst = 0;
float scale = 0.618; //缩放倍数为0.618倍
CvSize dst_cvsize;
/* the first command line parameter must be image file name */
if ( argc == 2 && (src = cvLoadImage(argv[1], -1))!=0 )
{
;
}
else
{
src = cvLoadImage("d:/Bush01.jpg");
// }
dst_cvsize.width = src->width * scale;
dst_cvsize.height = src->height * scale;
dst = cvCreateImage( dst_cvsize, src->depth, src->nChannels);
cvResize(src, dst, CV_INTER_LINEAR);
cvNamedWindow( "src", CV_WINDOW_AUTOSIZE );
cvNamedWindow( "dst", CV_WINDOW_AUTOSIZE );
cvShowImage( "src", src );
cvShowImage( "dst", dst );
cvWaitKey(-1);
cvReleaseImage(&src);
cvReleaseImage(&dst);
cvDestroyWindow( "src" );
cvDestroyWindow( "dst" );
return 0;
}
posted on 2009-05-22 11:00
Hali 阅读(1307)
评论(0) 编辑 收藏 引用 所属分类:
OpenCV