1. The principle concept image sharpening
- Image sharpening is a highlight and strengthen technical edges and contours in the image scene. Image sharpening essentially
增加邻域间像素的差值
the mutated portion of the image becomes more apparent. - Convolution calculation can be done in addition to the image blur denoising, edge detection and other tasks, may also be implemented image sharpening / enhanced function. Generally through
Laplacian滤波加原图权重像素叠加锐化空间滤波器用来增强图像的突变信息,图像的细节和边缘信息
. - NOTE: Low-pass filter and a high pass filter
- Smoothing filter used mainly neighborhood mean (or median, integral) was used instead of the center of the pixel templates, and the differences between weakening neighborhood, in order to achieve a smooth image and the purpose of suppressing noise; blurred image, referred to as low-pass filter
- Sharpening filter using the differential operator as the neighborhood, increasing the difference between neighborhood pixels of the mutated portion of the image becomes more apparent. Sharpening effect is to enhance image and edge contours, usually a high-pass filter:
2.opencv achieve
Image sharpening image is essentially Laplacian filter weights applied picture pixel addition output: Laplacian
- When C represents a value greater than 8, when the image sharpening, the closer the better the sharpening 8
- When the value of C is equal to 8 when the image of the high-pass filter
- When the C value is larger, the effect of weakening the image sharpening, the lifting action of the central pixel
Code
#include <iostream> #include <opencv2/opencv.hpp> using namespace cv; using namespace std; int main(int argc, char* argv[]) { Mat src = imread("yuan_test.png"); if (src.empty()) { printf("could not load image...\n"); return -1; } namedWindow("input", CV_WINDOW_AUTOSIZE); imshow("input", src); Mat sharpen_op = (Mat_<char>(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0); Mat result; filter2D(src, result, CV_32F, sharpen_op); convertScaleAbs(result, result); imshow("sharpen image", result); waitKey(0); return 0; } //version1.1
Artwork
Sharpen map
Compared
FIG apparent sharpened after a few more texture detail than the picture elements
reference:
https://blog.csdn.net/PecoHe/article/details/95289957
https://blog.csdn.net/cyf15238622067/article/details/87859887
https://wx.zsxq.com/dweb2/index/group/551551828124?from=mweb&type=detail