Home » Source Code » BBHE算法

## BBHE算法

 yoyo2 2018-03-04 00:57:43 View(s): Download(s): 0 Point (s): 1 Rate: 0.0
 Category: matlab 的BBHE算法代码 All Download: 图像对比度增强算法(PDSize：42.68 kB FavoriteFavorite Preview code View comments

## Description

function BBHE2
%UNTITLED 此处显示有关此函数的摘要
%   此处显示详细说明
clc;
clear all
close all;

if size(I0,3)==3
I=rgb2gray(I0);
else
I=I0;
end
% figure,imshow(I);
% title('灰度图')
meanv=floor(mean(I(:)));
[m,n]=size(I);  %测量图像尺寸参数
pl=zeros(1,meanv);
pu=zeros(1,256);%预创建存放灰度出现概率的向量
nl=0;
nu=0;
for i=1:m
for j=1:n
if I(i,j)<meanv
pl(I(i,j) + 1) = pl(I(i,j) + 1)  + 1;
nl=nl+1;
else
pu(I(i,j)+1)=pu(I(i,j)+1)+1;
nu=nu+1;
end
end
end
pl=pl./nl;
pu=pu./nu;
cl=zeros(1,meanv+1);
cu=zeros(1,256);
cl(1)=pl(1);
cu(meanv+1)=pu(meanv+1);
for i=2:meanv
cl(i)=pl(i) + cl(i-1); %统计图像中<每个灰度级像素的累积个数，s(i):0,1,```,i-1
end
for i=meanv+2:256
cu(i)=pu(i)+cu(i-1);
end
for i=1:meanv
cl(i)=cl(i)*meanv;
end
for i=meanv+1:256
cu(i)=meanv+1+cu(i)*(256-meanv);
end
%图像均衡化
I_equal = I;
for i=1:m
for j=1:n
if I(i,j)<meanv
I_equal(i,j) = cl( I(i,j) + 1);
else
I_equal(i,j)=cu(I(i,j)+1);
end
end
end
pic=I_equal;
%figure,imshow(I_equal);
imshow(I_equal,'border','tight','initialmagnification','fit');
set (gcf,'Position',[0,0,1000,625]);
axis normal;
figure;
subplot(221);
imshow(I);
subplot(223);
imhist(I);
subplot(222);
imshow(I_equal);
subplot(224);
imhist(I_equal);
%显示均衡化后的图像
% title('均衡化后图像')
%
% q=zeros(1,256);                            %预创建存放灰度出现概率的向量
% for i=1:m
%     for j=1:n
%      q(I_equal(i,j) + 1) = q(I_equal(i,j) + 1)  + 1;
%     end
% end
% q=q/(m*n);
% x=0:255;
% figure(3);
% plot(x,q,'g');

end

## File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date

Minimum:15 words, Maximum:160 words
• 1
• Sent successfully!
• 图像对比度增强算法(PD
• 1 Point(s)

### BBHE算法(42.68 kB)

Need 1 Point(s)

Your Point isn't enough.

Get 22 Point immediately by PayPal

Point will be added to your account automatically after the transaction.

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more Points

Don't have an account？ Register now
Need any help?
Mail to: support@codeforge.com

### 切换到中文版？

CodeForge Chinese Version
CodeForge English Version

### ^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!

### Warm tip!

Favorite by Ctrl+D