資源簡介
BBHE/DSIHE/MMBEBHE代碼 matlab版

代碼片段和文件信息
clc
clear?all
image?=?imread(‘f:\27.bmp‘);??
hsvImg?=?rgb2hsv(image);??
gf=hsvImg(::3);??
[heightwidth]=size(gf);??
gf?=?uint8(gf*255);
gfMin=min(gf(:));
gfMax=max(gf(:));
%測量圖像尺寸參數
[st]=size(gf);
%計算每個灰度級出現的次數
h1=imhist(gf);
%計算圖像的平均灰度gray_mean
gray_mean=round(sum(gf(:))/(s*t))
????
%計算nlnu
nl=sum(h1(gfMin+1:gray_mean+1));
nu=sum(h1(gray_mean+2:gfMax+1));
%?計算BBH直方圖均衡化后的輸出Y(ij)
for?i=1:s
????for?j=1:t
????????x=gf(ij);
????????if?x<=gray_mean
????????????cl=sum(h1(gfMin+1:x+1))/nl;
????????????y(ij)=gfMin+(gray_mean-gfMin)*cl;
????????else
????????????cu=sum(h1(gray_mean+2:x+1))/nu;
????????????y(ij)=(gray_mean+1)+(gfMax-(gray_mean+1))*cu;
????????end??
????end
end
y=mat2gray(y);
%顯示BBH均衡化后的圖像及其直方圖
figureimshow(y)
title(‘BBH均衡化后的圖像‘);
y?=?im2double(y);?
hsvImg(::3)?=?y;??
outputImg?=?hsv2rgb(hsvImg);
%?subplot(121)imshow(image)title(‘原始圖片‘);?
%?subplot(122)imshow(outputImg)title(‘HE-HSV‘);?
%?imwrite(outputImg‘f:\27xxbbhe.bmp‘);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1089??2017-08-10?21:34??bbhe.m
?????文件????????989??2017-08-11?17:01??DSIHE_1999.m
?????文件???????1307??2017-08-10?21:34??MMBEBHE.m
-----------?---------??----------?-----??----
?????????????????3385????????????????????3
評論
共有 條評論