IplImage* doPyrDown(
IplImage* in)
{
// Best to make sure input image is divisible by two.
//
assert( in->width%2 == 0 && in->height%2 == 0 );
IplImage* out = cvCreateImage(
cvSize( in->width/2, in->height/2 ),
in->depth,
in->nChannels
);
cvPyrDown( in, out );
return( out );
};
int _tmain(int argc, _TCHAR* argv[])
{
IplImage* img = cvLoadImage("lena.jpg");
IplImage* img2;
cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE );
cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE );
cvShowImage("Example1", img );
img2 = doPyrDown( img );
cvShowImage("Example2", img2 );
cvWaitKey(0);
cvReleaseImage( &img );
cvReleaseImage( &img2 );
cvDestroyWindow("Example1");
cvDestroyWindow("Example2");
}
Transform img to 1/2
最新推荐文章于 2021-02-03 00:58:13 发布