opencv学习日记——图像的缩放resize
#include<iostream>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat gray = imread("xiaojiejie.jpg");
if (gray.empty())
{
cout << "输入为空" << endl;
return -1;
}
Mat smallimg, bigimg0, bigimg1, bigimg2;
resize(gray, smallimg, Size(120, 120), 0, 0, INTER_AREA);
resize(smallimg, bigimg0, Size(460, 460), 0, 0, INTER_NEAREST);
resize(smallimg, bigimg1, Size(460, 460), 0, 0, INTER_LINEAR);
resize(smallimg, bigimg2, Size(460, 460), 0, 0, INTER_CUBIC);
namedWindow("smalling", WINDOW_NORMAL);
imshow("smalling", smallimg);
imshow("bigimg0", bigimg0);
imshow("bigimg1", bigimg1);
imshow("bigimg2", bigimg2);
waitKey(0);
return 0;
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/aab19e991aa2e790b24beb5f84b3759d.png)