6주차 수업 끝
This commit is contained in:
31
ch07/sharpen/main.cpp
Normal file
31
ch07/sharpen/main.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include "opencv2/opencv.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
void unsharp_mask() {
|
||||
Mat src = imread("..\\..\\resources\\images\\rose.bmp", IMREAD_GRAYSCALE);
|
||||
|
||||
imshow("src", src);
|
||||
|
||||
for (int sigma = 1; sigma <= 5; sigma++) {
|
||||
Mat blurred;
|
||||
GaussianBlur(src, blurred, Size(), (double)sigma);
|
||||
|
||||
constexpr float alpha = 1.f;
|
||||
Mat dst = (1 + alpha) * src - alpha * blurred;
|
||||
|
||||
string text = format("sigma = %d", sigma);
|
||||
putText(dst, text, Point(10, 30), FONT_HERSHEY_SIMPLEX, 1.0, Scalar(255), 1, LINE_AA);
|
||||
|
||||
imshow(text, dst);
|
||||
waitKey(0);
|
||||
}
|
||||
destroyAllWindows();
|
||||
}
|
||||
|
||||
int main() {
|
||||
unsharp_mask();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user