A problem with quantization of HSI space

2 views (last 30 days)
preet
preet on 10 Oct 2013
Edited: preet on 11 Oct 2013
here H(0-360), S(0-1),I(0-1) . i want to divide in this way 12*3*3 .12-h,3-s,3-i
if I want to convert RGB in 4*4*4 , i am working like this
lbin=4;
abin=4;
bbin=4;
l=256/lbin;
a=256/abin;
b=256/bbin;
for(x=0;x<M;x++)
{
for(y=0;y<N;y++)
{
l1=LstarM1[x][y]/l;
a1=aM1[x][y]/a;
b1=bM1[x][y]/b;
bin=(l1*pow(lbin,2))+a1*pow(abin,1)+b1*pow(bbin,0);
count[bin]=count[bin]+1;
colorBin[x][y]=bin;
}//y
}//x
but i am trying to do this way in HSI , i am not getting the exact bins means 108 . when i am divide into 8*4*4 . use abin instead of lbin in following then i get the exact bins according to values and l=360/8
bin=(l1*pow(abin,2))+a1*pow(abin,1)+b1*pow(bbin,0);

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!