www.pudn.com > duge.rar > ave_gray.m, change:2014-11-09,size:319b


function [ ave ] = ave_gray( I ) 
%UNTITLED2 Summary of this function goes here 
%   Detailed explanation goes here 
%   均值,反映图像平均亮度   
I=rgb2gray(I); 
[M N]=size(I); 
Num=M*N; 
[counts,x]=imhist(I); 
p=zeros(size(x)); 
ave=0; 
for i=0:255 
    p(i+1)=counts(i+1)/Num;  
    ave=ave+i*p(i+1); 
end 
 
end