简体   繁体   English

将不同的直方图组合成一个Matlab

[英]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. 运行上面的代码后,我得到了不正确的直方图。 在此处输入图片说明

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. masterHist已经包含要绘制的数据。

bar(masterHist)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM