怎样用matlab做histogram(直方图)

来源:百度知道 编辑:UC知道 时间:2024/05/10 22:50:06
histogram已经会了.
不过怎么做 histogram equalization 呢(这个用matlab已经会了,但用c语言不知怎么做,就是说不知具体过程)
还有histogram matching, 这个比较重要
我会加分的

最简单的方法是:

>> x=randn(1,1000)
>> hist(x,15)%数字15代表分成15组

直接用matlab自带的函数
v=[1000,2001,3001,4002,5003,6003];

x=diff(v);
hist(x);
n_1000=length(find(x==1000))
n_1001=length(find(x==1001))

MATLAB

命令:I=imread('bmp格式的图像');

a=rgb2gray(b);

imhist(a);

VB,imhist也行

要有C语言用for(i=0;i<256;i++)
{
m_count[i]=0;
}

for(i=0;i<m_Height;i++)
for(j=0;j<m_Width;j++)
{
lpSrc=(unsigned char*)m_lpDIBBits+((m_Width*8+31)/32*4)*i+j;
m_count[*lpSrc]++;
}