MATLAB图像增强程序举例.docVIP

  • 9
  • 0
  • 约4.26千字
  • 约 8页
  • 2019-08-17 发布于江西
  • 举报
MATLAB图像增强程序举例 1.灰度变换增强程序: % GRAY TRANSFORM clc; I=imread(pout.tif); imshow(I); J=imadjust(I,[0.3 0.7],[0 1],1);??%transforms the walues in the %intensity image I to values in J by linealy mapping %values between 0.3 and 0.7 to values between 0 and 1. figure; imshow(J); J=imadjust(I,[0.3 0.7],[0 1],0.5);??% if GAMMA is less than 1,the ?mapping si weighted toward higher (brighter) %output values. figure; imshow(J); J=imadjust(I,[0.3 0.7],[0 1],1.5);??% if GAMMA is greater than 1,the mapping si weighted toward lower (darker) %output values. figure; imshow(J) J=imadjust(I,[0.3 0.7],[0 1],1);??% If TOPBOTTOM,the output image is reversed,as in a photographic negative. figure; imshow(J); ? 2.直方图灰度变换 %直方图灰度变换 [X,map]=imread(forest.tif); I=ind2gray(X,map);%把索引图像转换为灰度图像 imshow(I); title(原图像); improfile%用鼠标选择一条对角线,显示线段的灰度值 figure;subplot(121) plot(0:0.01:1,sqrt(0:0.01:1)) axis square title(平方根灰度变换函数) subplot(122) maxnum=double(max(max(I)));%取得二维数组最大值 J=sqrt(double(I)/maxnum);%把数据类型转换成double,然后进行平方根变换 %sqrt函数不支持uint8类型 J=uint8(J*maxnum);%把数据类型转换成uint8类型 imshow(J) title(平方根变换后的图像) 3.直方图均衡化程序举例 % HISTGRAM EAQUALIZATION clc; % Clear command window I=imread(tire.tif); % reads the image in tire.tif into I imshow(I); % displays the intensity image I with 256 gray levels figure; %creates a new figure window imhist(I); % displays a histogram for the intensity image I J=histeq(I,64); % transforms the intensity image I,returning J an intensity figure; %image with 64 discrete levels imshow(J); figure; imhist(J); J=histeq(I,32); %transforms the intensity image ,returning in % J an intensity figure; %image with 32 discrete levels imshow(J); figure; imhist(J); 4.直方图规定化程序举例 % HISTGRAM REGULIZATION clc; %Clear command window I=imread(tire.tif); %reads the image in tire.tif into I J=histeq(I,32); %transforms the intensity image I,returning in %J an intensity image with 32 discrete levels [counts,x]=imhist(J); %displays a histogram for the intensity image I Q=imread(pout.tif); %reads the imag

文档评论(0)

1亿VIP精品文档

相关文档