0

I am working on developing a CBIR system where I am using HSV histogram as one of my features. For each image I want to compute a histogram which has say n1 bins for hue, n2 for saturation and n3 for value. I want a vector which will be n1xn2xn3 dimensional having all possible combinations of these bins. for example: If I take a tuple (8, 12, 3) bins for hue, saturation and value respectively, then I want to compute a 8x12x3=288 dimensional vector. In openCV we have the calcHist() function to do so but I failed to find a similar function in matlab. here is what I have done

%roi1 is my region of interest, y1 is the vector 
y1=[imhist(roi1(:,:,1),8)' imhist(roi1(:,:,2),12)' imhist(roi1(:,:,3),3)'];

but y1 would be 23 dimensional rather than the desired 288 dimensional. Please help me on this, if there is a function similar to calcHist() of openCV then suggest me so.

user164013
  • 133
  • 1
  • 9

1 Answers1

0

What you have computed is a series of single-dimension histograms, rather than the multi-dimensional histogram. For example, imhist(roi1(:,:,1),8)' is the counts of only the hue values, ignoring corresponding saturation or value of the pixel. There is code on the Mathworks site to compute an n-dimensional histogram, which should provide what you're after: http://www.mathworks.com/matlabcentral/fileexchange/23897-n-dimensional-histogram

DMR
  • 1,479
  • 1
  • 8
  • 11