当前位置:网站首页>image enhancement

image enhancement

2022-07-08 02:10:00 Strawberry sauce toast

Catalog

 

The introduction

One 、 Spatial image enhancement algorithm

( One ) Direct gray transformation algorithm

1. Logarithmic transformation

2. Grayscale cut

( Two ) Histogram enhancement

1. Histogram properties

2. Histogram equalization

( 3、 ... and ) Grayscale adjustment

( Four ) Spatial filtering enhancement

1. Smooth filtering

(1) Linear smoothing filtering                     ​

(2) Nonlinear smoothing filtering

2. Sharpening filter

(1) Linear sharpening filter

(2) Nonlinear sharpening filter

Two 、 Frequency domain enhancement

( One ) Low pass filtering

1. Fourier transform low-pass filtering


The introduction

  • Image enhancement is to highlight some information in an image according to specific needs , At the same time, weaken or remove some unnecessary information , Subjective ;
  • Image enhancement makes the processed image more suitable for human visual characteristics or machine analysis , In order to achieve more advanced image processing and analysis ;
  • Image enhancement hopes to remove noise and enhance edges , But the two contradict , Therefore, image enhancement often compromises the two , Find a good cost function to achieve the purpose of enhancement
  • It is divided into Airspace enhancement and Frequency domain enhancement Two categories: .

One 、 Spatial image enhancement algorithm

airspace : Refers to the space composed of pixels , The spatial enhancement algorithm acts directly on the pixel value .

( One ) Direct gray transformation algorithm

1. Logarithmic transformation

characteristic : Compress the contrast of high gray areas in the input image , Expand the contrast of low gray value areas , It can make the details of the low gray value area easier to see .

2. Grayscale cut

(1) characteristic : Enhance the contrast of a specific range , Highlight the brightness of a specific gray range in the image .

(2) Method :(a) Display the gray level of interest with a larger value , Other gray levels are displayed with smaller gray values ;

                      (b) Display the gray level of interest with a larger value , Other gray levels remain unchanged .

( Two ) Histogram enhancement

1. Histogram properties

  • The histogram reflects the overall gray distribution of the image , Intuitively , If the pixels of an image occupy all possible gray levels and are evenly distributed , Then the image has high contrast ( Highest gray level / Minimum gray level ) And changeable gray tones ;
  • Histogram does not contain location information , Just reflect the amount of gray , It has nothing to do with the position of gray , Different images may have similar or identical histogram distribution ;
  • Histogram can be superimposed , The gray histogram of an image is equal to the sum of the histograms of its various parts ;
  • Histogram has statistical characteristics .

2. Histogram equalization

(1) advantage

The probability density function of the processed image can be approximately uniformly distributed , As a result, the dynamic range of pixel values is expanded ;

(2) shortcoming

Unable to suppress noise

( 3、 ... and ) Grayscale adjustment

J=imadjust(I,[low_in high_in],[low_out high_out],gamma);

among ,[low_in,high_in] Specifies the grayscale range that the input image needs to be mapped ,[low_out,high_out] Specifies the grayscale range of the output image .

            adopt gamma Parameters can choose the mapping method ,gamma=1 Time is linear mapping ,gamma<1, Brighter ;gamma>1, Darker .

                       

( Four ) Spatial filtering enhancement

1. Smooth filtering

Smooth filtering can be achieved by low-pass filtering , The purpose is to blur the image or eliminate image noise .

It is divided into linear smoothing filtering and nonlinear smoothing filtering .

(1) Linear smoothing filtering

a. Mean filtering

b. Gauss filtering : In essence, it belongs to weighted mean filtering , The weight of a pixel is obtained by Gaussian weighting from the distance from the point to the central pixel .

MATLAB Use fspecial Function to generate filter template

h=fspecial(type)
h=fspecial(type, parameters)

among ,type Used to specify filter type ,parameters Is a specific function related to the filter .

typeparameters explain
averagehsize

Rectangular mean filter ,hsize The format is [m,n], Used to specify the size of the rectangle

diskradius The generation radius is radius Circular filter
gaussianhsize,sigma The standard deviation is sigma、 The size is hize Gaussian low pass filter
laplacianalpha The coefficient is alpha Two dimensional Laplace operation
loghsize,sigma The standard deviation is sigma、 The size is hsize Gaussian filter rotationally symmetric Laplace operator
motionlen,theta By angle theta Move len Pixel motion filter
prewitt nothing Approximate computing gradient operator
sobel nothing The approximate calculation gradient operator of the spatial position between pixels is considered

e.g. Use mean filters of different sizes for the same image , Check the filtering effect .

I=imread('eight.tif');
subplot(221)
imshow(I);title(' Original picture ')
subplot(222)
J1=filter2(fspecial('average',3),I);
imshow(uint8(J1));title('3X3');
subplot(223)
J2=filter2(fspecial('average',5),I);
imshow(uint8(J2));title('5X5');
subplot(224)
J3=filter2(fspecial('average',7),I);
imshow(uint8(J3));title('7X7');

                                            

Although the mean filter considers the role of neighborhood points , But the influence of spatial location is not considered . actually , The point closer to a point in the neighborhood , The greater the impact on this point , The weighted mean filtering template can be used , For example, the weighting coefficient of the template is obtained by sampling the two-dimensional Gaussian function , The corresponding filter is called Gaussian filter .

121
242
121

(2) Nonlinear smoothing filtering

The most commonly used nonlinear smoothing filter is median filter , That is, the pixels of the image in the neighborhood are sorted by gray level , Then choose the intermediate value as the filtering result .

B=medfilt2(A)
B=medfilt2(A,[m n])
B=medfilt2(A,[m n],padopt)

among ,[m n] Specify the size of the filter template , The default size is 3*3;padopt Used to specify the image matrix A The continuation form of the edge of .

Median filter is better than mean filter in detail retention .

2. Sharpening filter

(1) Linear sharpening filter

Linear high pass filter template :

-1-1-1
-18-1
-18-1

Laplace operator : The center coefficient is greater than 0, Other coefficients are less than 0, The sum of all coefficients is 0. When the Laplace template slides in the image , For areas with little or no change in grayscale , Its filter output is small or 0.

e.g. High pass filtering of an image using Laplace operator .

I=imread('blobs.png');
h=fspecial('laplacian');
J=filter2(h,I);
subplot(121)
imshow(I);title(' Original picture ');
subplot(122)
imshow(J);title(' Laplace filtering ')

                                           

(2) Nonlinear sharpening filter

  • The mean filter can blur the image , It is summed in the calculation process , Mathematically corresponding to integral ;
  • The nonlinear sharpening filter is mathematically realized by differentiation , among Gradient operator Is the most commonly used differential operator , Describes the gray change rate of the image along a certain direction .
  • The commonly used spatial nonlinear sharpening filter operators are sobel operator 、prewitt operator 、log operator ( Laplace Gauss operator ), The definition of these operators is mainly based on the basic concept of differentiation .

e.g. Different nonlinear sharpening filters are used to filter the image

I=imread('blobs.png');
h1=fspecial('sobel');
J1=filter2(h1,I);
h2=fspecial('prewitt');
J2=filter2(h2,I);
h3=fspecial('log');
J3=filter2(h3,I);
subplot(221)
imshow(I);title(' Original picture ');
subplot(222)
imshow(J1);title('sobel operator ')
subplot(223)
imshow(J2);title('prewitt operator ')
subplot(224)
imshow(J3);title('log operator ');

                                      

default sobel Operator and prewitt Operators are solving horizontal details , That is, differential calculation in the vertical direction , The vertical details can be extracted by transposing the templates of these two operators .

h2_2=h2';
J2_2=filter2(h2_2,I);
figure
subplot(131)
imshow(J2);title(' Level of detail ')
subplot(132);
imshow(J2_2);title(' Vertical details ')
subplot(133);
imshow(or(J2,J2_2),[]);title(' Full details ')

                 

Two 、 Frequency domain enhancement

      Frequency domain enhancement is to transform the image to other space first , Then we use the characteristics of this space to process the data in the transform domain , Finally, it is transformed into the original image space .

      Frequency domain enhancement is mainly divided into 3 Step :

  1. Choose the appropriate transformation method , Transform the image into frequency domain space ;
  2. According to the processing objectives , The transform coefficients are processed in the frequency domain space ;
  3. Inverse transform the processed result , Get the enhanced image .

( One ) Low pass filtering

The energy of signal or image is mainly concentrated in low frequency and intermediate frequency , And noise often appears in high frequency , therefore , Using low-pass filter can achieve the purpose of denoising .

1. Fourier transform low-pass filtering

......

 

 

 

原网站

版权声明
本文为[Strawberry sauce toast]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130540433868.html