[Digital Image Processing] Experiment (2) - Image Enhancement (MATLAB Implementation)

1. The significance and purpose of the experiment

(1) Further master the image processing tool Matlab, and be familiar with Matlab-based image processing functions.
(2) Master various image enhancement methods.

2. Experimental content

1. Open a color image Image1, use the Matlab image processing function to perform the following transformations:
(1) Convert Image1 to gray, and make statistics and display its gray histogram;
(2) Perform piecewise linearization on gray Transformation;
(3) Histogram equalization for gray;
(4) Pseudo-color enhancement for gray;
(5) Add noise and smooth for gray;
(6) Sharpen gray with Sobel operator;
(7) Experimental requirements extensions in .

2. Expanded content:
(1) Check the processing effect for the above processing transformation parameters;
(2) Change the false color enhancement method to hot metal encoding or rainbow encoding;
(3) Design different smoothing and sharpening filtering methods, and check the processing Effect;
(4) Self-designed method to achieve color image enhancement processing.

3. Experimental principle

1. Grayscale linear transformation is to transform the grayscale of all points in the image according to the linear grayscale transformation function.
2. Histogram equalization transforms the input image into an output image with an equal number of pixels at each level through point operations.
3. Pseudo-color enhancement: a technical means of mapping different gray levels of a black-and-white domain image into a color image.
4. Sharpening: The image is degraded by various interferences during transmission or transformation (such as not focusing well), typically blurring the image, and in image interpretation and recognition, it is often necessary to highlight the outline of the target or edge information.
5. Edge sharpening: mainly enhance the contour edge and details of the image (gray level jump part), to highlight the edge or texture of the scene in the image, form a complete object boundary, and make the image with blurred edges and contours clear, also called empty space High-pass filtering (commonly known as delineation processing).

4. Introduction of Matlab related functions

(1) imhist function
Function: Statistically change the histogram of the displayed image.
Call format:
imhist(I): Display the histogram of image I.
imhist(I, n): Display the histogram of image I, n specifies the number of columns in the histogram.
[COUNTS,X] = imhist(…) : Returns the histogram data vector COUNTS and the corresponding color value vector X.
(2) histeq function
Function: histogram equalization
Call format:
J = histeq(I,hgram): convert the histogram of image I into a user-specified vector hgram, and the value range of each element in hgram is [0,1] ;
J = histeq(I,N): Perform histogram equalization on the original image I, N is the grayscale technology of the output image, and the default N is 64.
(3) imadjust function
Function: adjust the gray value of the image or the color mapping table, and increase the contrast of the image.
Call format:
J = imadjust(I,[LOW_IN; HIGH_IN],[LOW_OUT; HIGH_OUT],GAMMA): adjust the gray value of image I; [LOW_IN; HIGH_IN] specifies the gray range to be transformed in the original image; [LOW_OUT ; HIGH_OUT] specifies the range of gray scale after transformation; if it is lower than LOW_IN or higher than HIGH_IN, it adopts the interception formula; both can use an empty matrix [], the default value is [0 1]; GAMMA is a scalar, specify the description value I and value The shape of the curve of the J relationship. If it is less than 1, this mapping will focus on higher value (bright) output. If gamma is greater than 1, this mapping will focus on lower value (dark) output. If this parameter is omitted, the default is (linear mapping).
NEWMAP = imadjust(MAP,[LOW_IN; HIGH_IN],[LOW_OUT; HIGH_OUT],GAMMA): Adjust the color table map of the index image, and other parameters are the same as above.
RGB2 = imadjust(RGB1,…): Adjust the R, G, and B components of the RGB image RGB1.
(4) imnoise function
J = imnoise(I,type,parameters): add noise to the image I according to the specified type; type indicates the type of noise, and parameters are the corresponding parameters. The possible values ​​are shown in Table 1: Table 1
imnoise Function parameter table
insert image description here
(5) fspecial function
h=fspecial(type,parameters): create a two-dimensional filter h of the specified type and parameters, as shown in Table 2: Table
2 fspecial function parameter table
insert image description here
(6) filter2 function
Y = filter2( B,X,shape): use the two-dimensional FIR filter B to filter the matrix X; shape specifies the form of the return value Y, 'full': the dimension of Y is greater than X; 'same': the dimension of Y is equal to X; 'valid': Y has less dimension than X; defaults to same.
(7) imfilter function
B=imfilter(A,H,option1,option2,…): According to the specified attributes option1, option2…etc., use the multi-dimensional filter H to filter the image A, H is often obtained by the output of the function fspecial. Attribute parameters are shown in Table 3:
Table 3 imfilter function parameter table
insert image description here
(8) medfilt2 function
B = medfilt2(A,[mn]]): Median filtering of image A with a filter of size [mn], the output image is B, and the default filter size is 3×3.
(9) edge function
BW = edge(I): Perform edge detection on the grayscale or binary image I. The detected image is a binary image BW, and the value at the boundary is 1, otherwise it is 0. By default, the edge function uses the Sobel operator to detect edges, and an operator can also be specified.
BW = edge(I,'sobel'); BW = edge(I,'prewitt'); BW = edge(I,'roberts'); BW = edge(I,'log'); BW = edge(I
, 'canny') quotes are specified operators.
BW = edge(I,'sobel',thresh):thresh specifies the threshold for retaining the edge. If it is 0, the edge function automatically selects this value.

5. Code and results

(1) Grayscale Image1 into gray, count and display its grayscale histogram;

(2) Perform piecewise linear transformation on gray;

code:

Image1=im2double(imread('lotus.bmp'));
gray=rgb2gray(Image1);
imhist(gray),title('灰度直方图'); 
[h,w]=size(gray);                                     
NewImage1=zeros(h,w);                 
a=80/256; b=180/256; c=30/256; d=220/256;
for x=1:w
    for y=1:h
        if gray(y,x)<a 
            NewImage1(y,x)=gray(y,x)*c/a;
        elseif gray(y,x)<b
            NewImage1(y,x)=(gray(y,x)-a)*(d-c)/(b-a)+c;
        else
            NewImage1(y,x)=(gray(y,x)-b)*(255-d)/(255-b)+d;
        end                                               
    end
end
figure,imshow(NewImage1),title('分段线性变换');

result:
insert image description here
insert image description here

(3) Perform histogram equalization on gray;

code:

Image1=im2double(imread('lotus.bmp'));
gray=rgb2gray(Image1);
NewImage2=histeq(gray);
figure,imshow(NewImage2),title('直方图均衡化');

result:
insert image description here

(4) Pseudo-color enhancement of gray;

code:

Image1=im2double(imread('lotus.bmp'));
gray=rgb2gray(Image1);
NewImage3=zeros(h,w,3);
for x=1:w
    for y=1:h
        if gray(y,x)<64/256
            NewImage3(y,x,1)=0;
            NewImage3(y,x,2)=4*gray(y,x);
            NewImage3(y,x,3)=1;
        elseif gray(y,x)<128/256
            NewImage3(y,x,1)=0;
            NewImage3(y,x,2)=1;
            NewImage3(y,x,3)=2-4*gray(y,x);
        elseif gray(y,x)<192/256
            NewImage3(y,x,1)=4*gray(y,x)-2;
            NewImage3(y,x,2)=1;
            NewImage3(y,x,3)=0;
        else
            NewImage3(y,x,1)=1;
            NewImage3(y,x,2)=4-4*gray(y,x);
            NewImage3(y,x,3)=0;
        end
    end
end
figure,imshow(NewImage3),title('伪彩色增强');

result:
insert image description here

(5) Add noise to gray and smooth it;

code:

Image1=im2double(imread('lotus.bmp'));
gray=rgb2gray(Image1);
noiseIsp=imnoise(gray,'salt & pepper',0.1);            
noiseIg=imnoise(gray,'gaussian');  
result1=medfilt2(noiseIsp); 
result2=medfilt2(noiseIg);
figure;
subplot(121),imshow(result1),title('椒盐噪声3×3中值滤波');
subplot(122),imshow(result2),title('高斯噪声3×3中值滤波');


result:
insert image description here

(6) Use the Sobel operator to sharpen the gray;

code:

Image1=im2double(imread('lotus.bmp'));
gray=rgb2gray(Image1);
H1=[-1 -2 -1;0 0 0;1 2 1]; 
H2=[-1 0 1;-2 0 2;-1 0 1];  
R1=imfilter(gray,H1);    
R2=imfilter(gray,H2);
edgeImage=abs(R1)+abs(R2);    
sharpImage=gray+edgeImage;               
figure;
subplot(121),imshow(edgeImage),title('Sobel梯度图像');             
subplot(122),imshow(sharpImage),title('Sobel锐化图像');

result:
insert image description here

(7) Expand content

(1) Change the parameters of the above processing to check the processing effect;

code:

Image1=im2double(imread('lotus1.bmp'));
gray=rgb2gray(Image1);
noiseIsp=imnoise(gray,'salt & pepper',0.05);            
noiseIg=imnoise(gray,'gaussian',0.15);  
result1=medfilt2(noiseIsp); 
result2=medfilt2(noiseIg);
figure;
subplot(121),imshow(result1),title('椒盐噪声3×3中值滤波(参数0.05)');
subplot(122),imshow(result2),title('高斯噪声3×3中值滤波(参数0.15)');

result:
insert image description here

(2) Change the false color enhancement method to hot metal encoding or rainbow encoding;

Thermal Metal Coding
Code:

Image1=imread('lotus.bmp');
 
%转换为灰度
gray=rgb2gray(Image1);
[h,w]=size(gray);
%新图像的矩阵
NewImage4=zeros(h,w,3);
for x=1:h
    for y=1:w
        if gray(x,y)<64
        NewImage4(x,y,1)=0;
        elseif gray(x,y)<128
        NewImage4(x,y,1)=255*(gray(x,y)-64)/64;
        else
        NewImage4(x,y,1)=255;
        end
    end
end
for x=1:h
    for y=1:w
        if gray(x,y)<128
        NewImage4(x,y,2)=0;
        elseif gray(x,y)<192
        NewImage4(x,y,2)=255*(gray(x,y)-128)/64;
        else
        NewImage4(x,y,2)=255;
        end
    end
end
for x=1:h
    for y=1:w
        if gray(x,y)<64
        NewImage4(x,y,3)=255*gray(x,y)/64;
        elseif gray(x,y)<96
        NewImage4(x,y,3)=255;
        elseif gray(x,y)<128
        NewImage4(x,y,3)=255*(128-gray(x,y))/32;
        elseif gray(x,y)<192 
        NewImage4(x,y,3)=0;
        else
        NewImage4(x,y,3)=255*(gray(x,y)-192)/64;
        end
    end
end
imshow(NewImage4),title('热金属编码')

result:
insert image description here

Rainbow code
code:

Image1=imread('lotus1.bmp');
    
%转换为灰度
gray=rgb2gray(Image1);
[h,w]=size(gray);
%新图像的矩阵
NewImage3=zeros(h,w,3);
for x=1:h
    for y=1:w
        if gray(x,y)<96
        NewImage3(x,y,1)=0;
        elseif gray(x,y)<128
        NewImage3(x,y,1)=255*(gray(x,y)-96)/32;
        else
        NewImage3(x,y,1)=255;
        end
    end
end
for x=1:h
    for y=1:w
        if gray(x,y)<32
        NewImage3(x,y,2)=0;
        elseif gray(x,y)<64
        NewImage3(x,y,2)=255*(gray(x,y)-32)/32;
        elseif gray(x,y)<128
        NewImage3(x,y,2)=255;
        elseif gray(x,y)<192
        NewImage3(x,y,2)=255*(192-gray(x,y))/64;
        else
        NewImage3(x,y,2)=255*(gray(x,y)-192)/64;
        end
    end
end
for x=1:h
    for y=1:w
        if gray(x,y)<32
        NewImage3(x,y,3)=255*gray(x,y)/32;
        elseif gray(x,y)<64
        NewImage3(x,y,3)=255;
        elseif gray(x,y)<96
        NewImage3(x,y,3)=255*(96-gray(x,y))/32;
        elseif gray(x,y)<192 
        NewImage3(x,y,3)=0;
        else
        NewImage3(x,y,3)=255*(gray(x,y)-192)/64;
        end
    end
end
imshow(NewImage3),title('彩虹编码')

result:
insert image description here

(3) Design different smoothing and sharpening filtering methods to check the processing effect;

Smooth filter
code:

Image1=im2double(imread('lotus.bmp'));
gray=rgb2gray(Image1); 
noisegaus=imnoise(gray,'gaussian'); %高斯噪声 
figure; 
subplot(121),imshow(gray),title('原图'); 
subplot(122),imshow(noisegaus),title('高斯噪声图'); 
result1=filter2(fspecial('average',3),noisegaus); 
figure; 
imshow(result1),title('3*3 均值滤波');
gausFilter=fspecial('gaussian',[2*3+1 2*3+1],0.6); 
result2 = imfilter(noisegaus,gausFilter,'conv'); 
figure; 
imshow(result2),title('sigmal=0.6 高斯滤波');
result3 = medfilt2(noisegaus); 
figure; 
imshow(result3),title('3*3 中值滤波'); 
 
image2 = imread('lotus.bmp'); 
image2 = imnoise(image2,'gaussian'); 
Fimage = fftshift(fft2(double(image2))); 
[N M] = size(Fimage); 
g = zeros(N,M); 
r1 = floor(M/2); r2=floor(N/2); 
d0 = [5 11 45 68]; 
for i = 1:4 
    for x = 1:M 
        for y = 1:N 
            d = sqrt((x-r1)^2+(y-r2)^2); 
            if d<=d0(i) 
                h=1; 
            else
                h=0;
            end
            g(y,x) = h*Fimage(y,x); 
        end
    end
    g = real(ifft2(ifftshift(g))); 
    figure,imshow(uint8(g)),title(['理想低通滤波 D0=',num2str(d0(i))]); 
end

Result:
insert image description here
insert image description here
3*3 median filter
insert image description here

Sharpening filter
code:

Image1=im2double(imread('lotus.bmp'));
gray=rgb2gray(Image1);
H1=[-1 -2 -1;0 0 0;1 2 1];
H2=[-1 0 1;-2 0 2;-1 0 1];
R1=imfilter(gray,H1);
R2=imfilter(gray,H2);
edgeImage=abs(R1)+abs(R2); 
sharpImage=gray+edgeImage; 
figure; 
subplot(121),imshow(edgeImage),title('Sobel 梯度图像'); 
subplot(122),imshow(sharpImage),title('Sobel 锐化图像 ');
H1=[1 0;0 -1]; H2=[0 1;-1 0]; R1=imfilter(gray,H1); 
R2=imfilter(gray,H2); edgeImage=abs(R1)+abs(R2);
sharpImage=gray+edgeImage; 
figure; subplot(121),imshow(edgeImage),title('Roberts 梯度图像 '); 
subplot(122),imshow(sharpImage),title('Roberts 锐化图像 ');
H1=[-1 -1 -1;0 0 0;1 1 1];
H2=[-1 0 1;-1 0 1;-1 0 1]; 
R1=imfilter(gray,H1); 
R2=imfilter(gray,H2); 
edgeImage=abs(R1)+abs(R2); 
sharpImage=gray+edgeImage; 
figure; 
subplot(121),imshow(edgeImage),title('Prewitt 梯度图像 '); 
subplot(122),imshow(sharpImage),title('Prewitt 锐化图像 ');
H = fspecial('laplacian',0);
R = imfilter(gray,H); 
edgeImage = abs(R); 
H1 = [0 -1 0;-1 5 -1;0 -1 0]; 
sharpImage = imfilter(gray,H1);
figure;
subplot(121),imshow(edgeImage),title('Laplacian 滤波图 像'); 
subplot(122),imshow(sharpImage),title('Laplacian锐化图 像');
BW = edge(gray,'log'); 
H = fspecial('log',7,1); 
R = imfilter(gray,H); 
edgeImage = abs(R); 
sharpImage = gray+edgeImage; 
figure;
subplot(131),imshow(BW),title('LOG 边缘检测图像'); 
subplot(132),imshow(edgeImage),title('LOG 梯度图像'); 
subplot(133),imshow(sharpImage),title('LOG 锐化图像');
BW = edge(gray,'canny');
figure; 
imshow(BW),title('Canny 边缘检测');

Result:
Sobel operator rendering

insert image description here
Effect diagram of Roberts operator

insert image description here
Effect diagram of Prewitt operator Effect
insert image description here
diagram of Laplacian operator
insert image description here

Effect diagram of LOG operator
insert image description here

Canny operator rendering
insert image description here

(4) Self-designed method to realize color image enhancement processing.

Image enhancement mainly enhances two aspects, one is the brightness of the image, and the other is the contrast of the image.
Reference link: https://www.jianshu.com/p/5a8d12d6c649
**The first method: **Convert the image in RGB format to HSV or HSI format, and modify the brightness value. It is mainly to equalize the V value histogram.
code:

clear all;
close all;
RGB=imread('lotus.bmp');
HSV=rgb2hsv(RGB);
H=HSV(:,:,1);
S=HSV(:,:,2);
V=HSV(:,:,3);
figure;
subplot(1,3,1),imhist(H);
subplot(1,3,2),imhist(S);
subplot(1,3,3),imhist(V);
V=histeq(V);
figure,imhist(V);
HSV(:,:,1)=H;
HSV(:,:,2)=S;
HSV(:,:,3)=V;
RGB_1=hsv2rgb(HSV);
figure;
subplot(1,2,1),imshow(RGB);
subplot(1,2,2),imshow(RGB_1);


result:
insert image description here

The second method is to directly perform histogram equalization on the three channels of RGB.
code:

clear all;
close all;
RGB=imread('lotus.bmp');
R=double((RGB(:,:,1)))/255;
G=double((RGB(:,:,2)))/255;
B=double((RGB(:,:,3)))/255;
figure;
subplot(1,3,1),imshow(R);
subplot(1,3,2),imshow(G);
subplot(1,3,3),imshow(B);
R=histeq(R);
G=histeq(G);
B=histeq(B);
RGB_1(:,:,1)=R;
RGB_1(:,:,2)=G;
RGB_1(:,:,3)=B;
figure;
subplot(1,2,1),imshow(RGB);
subplot(1,2,2),imshow(RGB_1),brighten(0.6);
figure;
subplot(1,3,1),imhist(R);
subplot(1,3,2),imhist(G);
subplot(1,3,3),imhist(B);


Results:
insert image description here
insert image description here
insert image description here
The third method is the one I currently use, based on an image enhancement method adopted by HE, BBHE, and DSIHE. The principle is briefly introduced as follows:
first convert the RGB image into a grayscale image, then the value of each grayscale image pixel is determined according to the maximum value method: max (R, G, B), and then the histogram
of the grayscale image is processed 1. Find the average value of the image, divide the histogram into two parts, and then perform equalization processing on the histograms of the two parts respectively.
After the processing is completed, the image is restored, that is, the grayscale image is converted into an RGB image, and the numerical ratio between the processed image and the previous image is found, and then multiplied by the image to obtain R, G, and B. The numeric value of the component.
code:

clear all;
close all;
clc;
RGB=imread('lotus.bmp');
[row,column,n]=size(RGB);
R=RGB(:,:,1);
G=RGB(:,:,2);
B=RGB(:,:,3);
for i=1:row
for j=1:column
juzhen=[R(i,j),G(i,j),B(i,j)];
intensity_1(i,j)=0.2989*R(i,j)+0.587*G(i,j)+0.114*B(i,j);
intensity_2(i,j)=1/3*(R(i,j)+G(i,j)+B(i,j));
intensity_3(i,j)=max(juzhen);
end
end
figure,
subplot(2,2,1),imshow(rgb2gray(RGB));
subplot(2,2,2),imshow(intensity_1);
subplot(2,2,3),imshow(intensity_2);
subplot(2,2,4),imshow(intensity_3);
Pre_image=intensity_3;
figure;
subplot(2,2,1),imshow(intensity_3);
subplot(2,2,2),imhist(intensity_3);
subplot(2,2,3),imshow(Pre_image);
subplot(2,2,4),imhist(Pre_image);
Pre_image=im2uint8(Pre_image);
[height,width]=size(Pre_image);
XT=round(mean(mean(Pre_image)));
h = zeros(1,256);%统计各灰度数目,共256个灰度级
for m = 1:height
for n = 1: width
h(Pre_image(m,n) + 1) = h(Pre_image(m,n) + 1) + 1;%对应灰度值像素点数量增加一
end
end
SH1=0;
SH2=0;
for x=0:XT
SH1=SH1+h(x+1);
end
for x=(XT+1):255
SH2=SH2+h(x+1);
end
N=height*width;
RSH1=SH1/N;
RSH2=SH2/N;
SEP_P=round(255*RSH1);
DRH1_start=0;
DRH1_end=SEP_P;
DRH2_start=SEP_P+1;
DRH2_end=255;
sum1=0;
CH1=zeros(1,256);
for x_1=0:XT
sum1=sum1+h(x_1+1);
CH1(x_1+1)=sum1/SH1;
end;
sum2=0;
CH2=zeros(1,256);
for x_2=(XT+1):255
sum2=sum2+h(x_2+1);
CH2(x_2+1)=sum2/SH2;
end
for i=1:height
for j=1:width
if Pre_image(i,j)
h(Pre_image(i,j)+1)=DRH1_start+(DRH1_end-DRH1_start)*CH1(Pre_image(i,j)+1);
else
h(Pre_image(i,j)+1)=DRH2_start+(DRH2_end-DRH2_start)*CH2(Pre_image(i,j)+1);
end
end
end
for i=1:height
for j=1:width
Aft_image(i,j)=h(Pre_image(i,j)+1);
end
end
Aft_image=uint8(Aft_image);
subplot(1,2,1),imhist(Aft_image);
subplot(1,2,2),imshow(Aft_image);
for i=1:height
for j=1:width
Alpha(i,j)=double(Aft_image(i,j))./double(intensity_3(i,j));
end
end
intensity_R=Alpha.*double(R);
intensity_G=Alpha.*double(G);
intensity_B=Alpha.*double(B);
RGB_1(:,:,1)=intensity_R;
RGB_1(:,:,2)=intensity_G;
RGB_1(:,:,3)=intensity_B;
figure,
subplot(1,2,2),imshow(uint8(RGB_1));
subplot(1,2,1),imshow(RGB);


result:
insert image description here
insert image description here
insert image description here

6. Experimental summary

1. Sharpening
(1) Sharpening: The image is degraded by various interferences during transmission or transformation (if not well focused), typically blurred images, and image interpretation and recognition often require Highlight the contour or edge information of the target.
(2) Edge sharpening: mainly enhance the contour edge and details of the image (gray jump part), to highlight the edge or texture of the scene in the image, form a complete object boundary, and make the image with blurred edges and contours clear, also known as Spatial high-pass filtering (commonly known as delineation processing).
From a mathematical point of view, image blur is equivalent to the image being averaged or integrated. In order to achieve image sharpening, we need to use its inverse operation "differentiation"-strengthening high-frequency components to achieve clear outlines.
Here we use the edge function that comes with matlab. The simple principles of the three filters are:
Sobel operator, taking a point as a reference to take out a 3*3 matrix from around, and combine it with the template matrix [-1 -2 -1 ;0 0 0;1 2 1] and [-1 0 1;-2 0 2;-1 0 1] are dot-multiplied and summed and stored in this point.
The Canny operator performs Gaussian filtering on the original image to smooth the image, calculates the gradient magnitude and direction with the first-order partial derivative finite difference, suppresses the non-maximum value of the gradient magnitude, and uses the double threshold algorithm to detect and connect the edges.
Laplacian operator, second-order differential operator, introduce template img2(i,j,k) = img1(i+1,j,k) + img1(i-1,j,k) + img1(i, j+1,k) + img1(i,j-1,k) - 4 * img1(i,j,k) for calculation.

2. Pseudo-color processing
Pseudo-color enhancement: a technical means of mapping different gray levels of a black-and-white domain image into a color image.
Spatial domain grayscale-color transformation method: grayscale images can be changed into continuous color images with multiple color gradients. The transformed image has better visual effect. The main hue is to send the grayscale image f(x,y) to Input three converters of red, green and blue with different transformation properties, correspondingly generate three different inputs fR(x, y), fG(x, y), fB(x, y) and use them as The red, green and blue color components of the color image are synthesized into a color image.
Rainbow coding and hot metal coding are two of the variation functions.

3. Image enhancement
The purpose of image enhancement: (1) Use a series of technologies to improve the visual effect of the image and improve the clarity of the image. (2) Convert the image into a form that is more suitable for human or machine analysis and processing, suppress useless information, and improve the value of image use.
Image enhancement is divided into: spatial domain enhancement, frequency domain enhancement, and color enhancement.
Among them, the spatial domain enhancement is to directly operate on the grayscale of image pixels. Including: point operation and local operation.
In the frequency domain, the image spectrum is manipulated after Fourier transform, and finally the inverse transform is performed to obtain the result.
Point operations include: grayscale transformation, histogram correction method and local statistics method.
1. Grayscale transformation
Grayscale transformation increases the dynamic range of the image, enhances the contrast, and makes the image clearer and features more obvious.
These include: linear transformation, piecewise linear transformation, nonlinear grayscale transformation.
(1) Linear transformation
The grayscale of the image is concentrated in the brighter area, resulting in a brighter image. At this time, the grayscale of each pixel of the image can be linearly stretched.
The grayscale range of the original image f(i,j) is [a,b], and the range of the image g(i,j) after linear transformation is [a1,b1]

Guess you like

Origin blog.csdn.net/m0_52435951/article/details/124615614