코드 7-2 평균값 필터를 이용한 블러링 [ch07/blurring]
01 void blurring_mean() 02 { 03 Mat src = imread("rose.bmp", IMREAD_GRAYSCALE); 04 05 if (src.empty()) { 06 cerr << "Image load failed!" << endl; 07 return; 08 } 09 10 imshow("src", src); 11 12 Mat dst; 13 for (int ksize = 3; ksize <= 7; ksize += 2) { 14 blur(src, dst, Size(ksize, ksize)); 15 16 String desc = format("Mean: %dx%d", ksize, ksize); 17 putText(dst, desc, Point(10, 30), FONT_HERSHEY_SIMPLEX, 1.0, 18 Scalar(255), 1, LINE_AA); 19 20 imshow("dst", dst); 21 waitKey(0); 22 } 23 24 destroyAllWindows(); 25 }