My opencv Study Notes (10): sharpening filter for airspace Filtering

Source: Internet
Author: User

Sharpening is used to strengthen the edge and contour of an image, and is usually used as a high-pass filter:

The template is generally designed as a center with a positive value and a negative peripheral value (the sum of the total coefficients is 0 ):

Int main () {// source image mat scr = imread ("D:/picture/IMG. TIF "); mat rst; imshow (" Original Image ", Scr); MAT kernel (3,3, cv_32f, scalar (-1); // assign pixels to set the kernel. at <float> (1, 1) = 8; filter2d (SCR, RST, SCR. depth (), kernel); imshow ("Sharpen result", RST); waitkey (0); Return 0 ;}

 

We can see that although the edge is enhanced, the layers and brightness of the image are basically lost. For those smaller than 0 after calculation with the template, they will be automatically set to 0, so there will be large pieces of black.

We usually use a high-gain filter, which enhances the edge and details without losing the low-frequency components of the source image:

High Gain = a source image-low-pass = (A-1) source image + (source image * low-pass) = (A-1) source image + Qualcomm, so when a> 1, A part of the source image is added to the result of Qualcomm filter.

For a 3*3 template, the number in the center is kernel () = 9a-1, And the other number is-1.

ProgramChange only one row:

Kernel. at <float> (1, 1) = 8.9;

 

The results are quite different:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.