matlabimage-processinglbph-algorithm

Combining different histogram into one Matlab


I am working on facial images, I have different image patches I already calculated the histogram for each patch, now I want to combine all patches histogram into one histogram, I am trying the following code which is given below, but I am not getting right histogram, please help.

P1 = imhist(uint8(patch1));
P2 = imhist(uint8(patch2));
p3 = imhist(uint8(patch3));
P4 = imhist(uint8(patch4));
P5 = imhist(uint8(patch5));
P6 = imhist(uint8(patch6));
P7 = imhist(uint8(patch7));
P8 = imhist(uint8(patch8));
masterHist=[P1,P2,P3,P4,P5,P6,P7,P8];
[final, GLd] = imhist(uint8(masterHist));
subplot();
bar(GLd, final);
title('Histogram of Local Binary Pattern Final', 'FontSize', 14);

After running the above code I got this histogram which is incorrect. enter image description here


Solution

  • The problem with your code is, you are taking the histogram of a histograms, resulting in more or less meaningless data. masterHist already contains the data you want to plot.

    bar(masterHist)