#include<opencv2/core/core_c.h>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/opencv.hpp>
#include<iostream>
#include<stdio.h>
using namespace cv;
using namespace std;
int main()
{
Mat tmpImage, dstImage1, dstImage2;
Mat src = imread("123.png");
imshow("原始图", src);
tmpImage = src;
dstImage1 = tmpImage;
int key = 0;
while (1)
{
key = waitKey(9);
switch (key)
{
case 27://退出
return 0;
break;
case '2':
pyrUp(tmpImage, dstImage1, Size(tmpImage.cols * 2, tmpImage.rows * 2));
break;
case '1':
pyrDown(tmpImage, dstImage1, Size(tmpImage.cols / 2, tmpImage.rows / 2));
}
imshow("效果图", dstImage1);
tmpImage = dstImage1;
}
//resize(tmpImage, dstImage1, Size(tmpImage.cols / 2, tmpImage.rows / 2), (0, 0), (0, 0), 3);
//resize(tmpImage, dstImage2, Size(tmpImage.cols *2, tmpImage.rows * 2), (0, 0), (0, 0), 3);
/*pyrUp(tmpImage, dstImage1, Size(tmpImage.cols * 2, tmpImage.rows * 2));
pyrDown(tmpImage, dstImage2, Size(tmpImage.cols / 2, tmpImage.rows / 2));
imshow("缩小效果图", dstImage2);
waitKey(0);*/
return 0;
}
在这里插入代码片
上采样,下采样,对图像进行缩放
最新推荐文章于 2024-11-13 13:44:26 发布