[Digital image processing] of the gradient image sharpening edge sharpening

 

And images for specific use in the actual scene will slowly update.

Sharpening gradient method

Tends to smooth the image boundaries in the image, the contours become blurred, to reduce the effect, image sharpening techniques need to use, so that the edge becomes clear. Commonly used methods are:

  • Instead of directly gradient value
  • Supplemented threshold judgment
  • To a specific predetermined edge of the gray level
  • Background to the predetermined gradation
  • The binarized image gradient

 

Gradient operation

  Gradient sharpening, first of all should know what gradient is how to calculate.

  A gradient vector are calculated from the differential in the x and y directions results configuration.

  Constitute the following ways:

 

 

 

Sharpening gradient

Instead of directly gradient value

Ideas: the target image pixel is replaced with a bi-directional differential results.

for(int i = 1; i < Use_ROWS- 1; i++)   
 {
   for(int j = 1; j < Use_Line -1; j++)
    {
      Image_Use[i][j] = sqrt((Image_Use[i][j+1] - Image_Use[i][j])*(Image_Use[i][j+1] - Image_Use[i][j])+(Image_Use[i+1][j] - Image_Use[i][j])*(Image_Use[i+1][j] - Image_Use[i][j]));
    }
  }

 

 

Supplemented threshold judgment

Thoughts: We take a pre-value gradient (rate of change), when the gradient of the image is small, originally luminance distribution inside the object data generated by the uneven variation, may not be taken into account. Only greater than or equal to some pre-value, it considered to be the border, otherwise revert to the original gray value.

If the rate of change exceeds a certain pre-value, that is the border, because the boundary value is small, the plus 100, the purpose of enhancing brightness (gradient), this value needs to determine what, if more than 255, 255 is directly equal.

 

 

 

To a specific predetermined edge of the gray level

Thinking: La predetermined gray value, we take the rate of change of a pre value, if the pre-gradient greater than or equal value, directly to la, or revert to the original gray value.

 

 

 

Background to the predetermined gradation

Ideas: Lb predetermined gradation value, we take the rate of change of the value of a pre, pre If the gradient value greater than or equal, to replace the original pixel value using a gradient otherwise Lb.

 

 

 

The binarized image gradient

Ideas: we take the rate of change of a pre-value, and if the gradient value is greater than or equal advance, set 255, set to 0 otherwise.

           int tidu=0,tidu_Threshold=50;for(int i = 1; i < Use_ROWS- 1; i++)   
                 {
                    for(int j = 1; j < Use_Line -1; j++)
                    {
                     tidu = sqrt((Image_Use[i][j+1] - Image_Use[i][j])*(Image_Use[i][j+1] - Image_Use[i][j])+(Image_Use[i+1][j] - Image_Use[i][j])*(Image_Use[i+1][j] - Image_Use[i][j]));
                     if(tidu>tidu_Threshold)
                       Image_Use[i][j] = 0;
                     else
                       Image_Use[i][j] = 255;
                    }
                 }

 

Guess you like

Origin www.cnblogs.com/-wenli/p/11511341.html