opencv学习笔记11-上采样pyrUp和降采样pyrDown

只用来记录学习笔记

1.上采样

pyrUp(src, dst, Size(src.cols * 2, src.rows * 2));
imshow("pyrUp", dst);

2.降采样

pyrDown(src, dst, Size(src.cols / 2, src.rows / 2));
imshow("pyrDown", dst);

效果图:
opencv学习笔记11-上采样pyrUp和降采样pyrDown_第1张图片

高斯金子塔的生成过程分为两步:

  • 对当前层进行高斯模糊
  • 删除当前层的偶数行与列

高斯模糊差值

	Mat gray_src, g1, g2, dogImg;
	cvtColor(src, gray_src, CV_BGR2GRAY); //变灰
	GaussianBlur(gray_src, g1, Size(3, 3), 0, 0); //高斯模糊
	GaussianBlur(g1, g2, Size(3, 3), 0, 0); //高斯模糊
	subtract(g1, g2, dogImg, Mat()); //g1-g2

	normalize(dogImg, dogImg, 255, 0, NORM_MINMAX);//归一化显示
	imshow("DOG Image", dogImg);

效果图:
opencv学习笔记11-上采样pyrUp和降采样pyrDown_第2张图片

你可能感兴趣的:(opencv)