上采样:图像分辨率增加
下采样:图像分辨率降低
#include<opencv2\opencv.hpp>
#include<opencv2\highgui\highgui.hpp>
#include<iostream>
#include<math.h>
using namespace std;
using namespace cv;
int main()
{Mat src = imread("E:\\vs2015\\opencvstudy\\1.jpg", 1);if (src.empty()){cout << "could not load the src image!" << endl;return -1;}char *input_title = "input Image";imshow(input_title, src);//上采样Mat up_dst,down_dst;pyrUp(src, up_dst, Size(src.cols * 2, src.rows * 2));imshow("pyrUp", up_dst);//降采样pyrDown(src, down_dst, Size(src.cols / 2, src.rows / 2));imshow("pyrDown", down_dst);//高斯不同Mat gray_image,gaussdiff_dst1, gaussdiff_dst2,Result;cvtColor(src, gray_image, CV_BGR2GRAY);GaussianBlur(src, gaussdiff_dst1, Size(7,7), 0, 0);GaussianBlur(gaussdiff_dst1, gaussdiff_dst2, Size(7, 7), 0, 0);subtract(gaussdiff_dst1, gaussdiff_dst2,Result, Mat());//归一化显示normalize(Result, Result, 255, 0, NORM_MINMAX);imshow("Result", Result);waitKey(0);return 0;
}