使用均值濾波操作的blur函數:
函數代碼:
#include<opencv2\highgui\highgui.hpp>
#include<opencv2\imgproc\imgproc.hpp>
using namespace cv;
int main(){
//載入圖片
Mat srcImage = imread("1.jpg");
//顯示原始圖
imshow("【原圖】均值濾波", srcImage);
//進行均值濾波操作
Mat dstImage;
blur(srcImage, dstImage, Size(7, 7));
//顯示效果圖
imshow("【效果圖】均值濾波", dstImage);
waitKey(0);
}
運行效果: