Digital Image Processing: Experiment 8 Remote Sensing Image Enhancement

Experiment 8 Remote Sensing Image Enhancement

1. Purpose of the experiment

  1. Familiar with the principle of image enhancement in MATLAB;
  2. Master remote sensing image grayscale transformation, histogram adjustment and other enhancement methods.

2. Experimental instruments and equipment

Computer, Matlab image processing software, Landsat8 remote sensing image

3. Experimental content and steps


  1. The method of image contrast enhancement for reading remote sensing image header files can be divided into two categories, one is the direct contrast enhancement method, and the other is the indirect contrast enhancement method. Histogram equalization and linear stretching are the two most common indirect contrast enhancement methods . The enhancement method, histogram equalization is to adjust the gray value by using the cumulative function to enhance the contrast. Linear stretching adjusts the histogram through contrast stretching to expand the difference between the foreground and background gray levels to achieve the purpose of enhancing contrast. This method can be implemented using linear or nonlinear methods, such as exponential transformation, logarithmic Transformation and linear stretching etc.
1.直方图均衡化
直方图均衡化处理的中心思想是将原始图像的灰度直方图从比较集中的某个灰度区间变成在全部灰度范围内的均匀分布,通过对图像进行非线性拉伸,重新分配图像像素值,使一定灰度范围内的像素数据大致相同,从而使得给定图像的直方图分布变成均匀分布。

2.指数变换
指数变换可以将遥感图像的灰度值部分进行压缩,高灰度值部分进行扩展,以达到增强遥感影像高灰度部分的目的。

3.对数变换
对数变换可以将遥感图像的低灰度值部分进行扩展,高灰度值部分进行压缩,以达到增强遥感影像低灰度部分的目的。

4.线性拉伸
线性拉伸是为了突出感兴趣的目标或灰度区间相对抑制那些不感兴趣的灰度区域。

4. Experimental content and steps

  1. Histogram equalization
src_img=data(:,:,6);
%转为8bit图像,以波段6为例
min_val=min(min(src_img));
max_val=max(max(src_img));
for i=1:lines
    for j=1:samples
        src_img(i,j)=(src_img(i,j)-min_val)/(max_val-min_val)*255;
    end
end
src_img=uint8(src_img);
figure(1);
subplot(2,2,1),imshow(src_img),title('原图像');
subplot(2,2,2),imhist(src_img),title('原图像直方图');
matlab_eq=histeq(src_img);
subplot(2,2,3),imshow(matlab_eq),title('matlab直方图均衡化原图像');
subplot(2,2,4),imhist(matlab_eq),title('matlab直方图均衡化直方图');

insert image description here

Graph Histogram Equalization
2. Exponential Transformation

gamma=0.4;
c=1;
g2=data(:,:,6);
g2=c*(g2.^gamma);
%归一化
min_val=min(min(g2));
max_val=max(max(g2));
for i=1:lines
    for j=1:samples
        g2(i,j)=(g2(i,j)-min_val)/(max_val-min_val)*255;
    end
end
g2=uint8(g2);
figure(1);
subplot(2,2,1),imshow(src_img),title('原图像');
subplot(2,2,2),imhist(src_img),title('原图像直方图');
subplot(2,2,3),imshow(g2),title('增强图像');
subplot(2,2,4),imhist(g2),title('增强图像直方图');

insert image description here

Figure 2 Exponential transformation
3. Logarithmic transformation

c1=1.0;
g=double(src_img);
v1=10;
v2=100;
v3=200;
g11=c*log2(1+v1*g)/log2(v1+1);
g22=c*log2(1+v2*g)/log2(v2+1);
g33=c*log2(1+v3*g)/log2(v3+1);
%归一化
min_val1=min(min(g11));
max_val1=max(max(g11));
min_val2=min(min(g22));
max_val2=max(max(g22));
min_val3=min(min(g33));
max_val3=max(max(g33));
for i=1:lines
    for j=1:samples
        g11(i,j)=(g11(i,j)-min_val1)/(max_val1-min_val1)*255;
        g22(i,j)=(g22(i,j)-min_val2)/(max_val2-min_val2)*255;
        g33(i,j)=(g33(i,j)-min_val3)/(max_val3-min_val3)*255;
    end
end
g=uint8(g);
g11=uint8(g11);
g22=uint8(g22);
g33=uint8(g33);
figure(1);
subplot(2,2,1),imshow(g),title('原图像');
subplot(2,2,2),imshow(g11),title('增强图像v=10');
subplot(2,2,3),imshow(g22),title('增强图像v=100');
subplot(2,2,4),imshow(g33),title('增强图像v=2000');

insert image description here

Figure 3 Logarithmic transformation
4. Linear stretching

g=double(src_img);
[m,n,w]=size(g);
figure(1);
imshow(src_img);title('原图像');
mid=mean(mean(g));
%横轴
fa=20;fb=120;
%纵轴
ga=100;gb=255;
[height,width]=size(g);
dst_img=uint8(zeros(height,width));
g=double(g);
%三段斜率
k1=ga/fa;
k2=(gb-ga)/(fb-fa);
k3=(255-ga)/(255-fa);
for i=1:height
    for j=1:width
        if g(i,j)<=fa
            dst_img(i,j)=k1*g(i,j);
        elseif fa<g(i,j) && g(i,j)<=fb
             dst_img(i,j)=k2*(g(i,j)-fa)+ga;
        else
            dst_img(i,j)=k3*(g(i,j)-fb)+gb;
        end
    end
end
dst_img=uint8(dst_img);
j=dst_img;
figure(2);
imshow(j);title('线性拉伸图像');

pixel_f=1:256;
pixel_g=zeros(1,256);
%三段斜率,小于1表示该段江北压缩
k1=ga/fa;
k2=(gb-ga)/(fb-fa);
k3=(255-ga)/(255-fa);
for i=1:256
        if i<= fa
            pixel_g(i)=k1*i;
        elseif fa<i && i<=fb
             pixel_g(i)=k2*(i-fa)+ga;
        else
            pixel_g(i)=k3*(i-fb)+gb;
        end
end
figure(3);
plot(pixel_f,pixel_g);

insert image description here
insert image description here

insert image description here

Figure 4 Linear Stretch

5. Experimental experience

1. Learned the enhancement processing of remote sensing images.
2. Through appropriate enhancement operations, some details of the image can be highlighted, making image information extraction and image interpretation easier.

Guess you like

Origin blog.csdn.net/chengzilhc/article/details/124557064