opencv之pyrDown与pyrUp

#include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include#include
using namespace cv;
#define TIME_DELAY 1000//金字塔缩放一次的间隔 #define MAX_COL 1500//金字塔最大图像的col限制 #define MIN_COL 200//金字塔最小图像的col限制
/** @function main */ int main( int argc, char** argv ) { Mat src=https://www.it610.com/article/imread(argv[1]),dst,tmp; /*首先多图像放大,以便更好的产生动画的效果*/ for(; ; ) { pyrUp(src,tmp); src=tmp; if(src.cols>=MAX_COL)break; } cvNamedWindow( "pyrDown", CV_WINDOW_AUTOSIZE ); //创建命名窗口 for(; ; ) { pyrDown(src,dst); imshow("pyrDown",dst); if(waitKey(TIME_DELAY)>0)break; src=https://www.it610.com/article/dst; if(src.cols<=MIN_COL)src=tmp; } cvDestroyWindow("pyrDown" ); //销毁窗口 return 0; }

    推荐阅读