opencv學習(6) 一個非常簡單的圖像均值模糊程序

直接貼代碼吧,太簡單了,就是調用下blur函數:
//本程序驗證圖像模糊

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;
using namespace std;

int main()
{
	Mat rawImg = imread("D:/fodder/3.jpg");
	Mat imgBlur;

	if(!rawImg.data)
	{
		cout << "";
		return -1;
	}
	
	namedWindow("原始圖像");
	imshow("原始圖像", rawImg);
	blur(rawImg, imgBlur, Size(9,9));
	namedWindow("模糊圖像");
	imshow("模糊圖像", imgBlur);

	waitKey(0);
	destroyAllWindows();

	return 0;
}


原圖像:

模糊後的結果:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章