Concatenation of 25 Histograms

2 views (last 30 days)
Mansell Teh
Mansell Teh on 2 Nov 2016
Answered: Nick Counts on 5 Nov 2016
I am currently doing face recognition system. I have calculated the normalized histogram for 25 subjects and now I want to concatenate the 25 histogram together in order to do classification using K-Nearest neighbor.
But the question is, how do I concatenate all these histogram together?

Accepted Answer

Nick Counts
Nick Counts on 5 Nov 2016
Mansell,
Without seeing how you are storing these histograms, it is difficult to answer.
However, if you are using any of Matlab's built-in variable types (matrices, structures, even objects) you can use cat or any of its variants.
Look at:
help cat
help vertcat
I am not an expert on the kNN, but my guess is that your implementation is designed to operate on a matrix. In that case, you probably have a particular matrix shape (dimensions) that is required. Remember that Matlab matrices can have more than 2 dimensions.
trainingSet1 = ones(10,2);
trainingSet2 = ones(10,2)*2;
trainingSet3 = ones(10,2)*3;
allHistograms(1,:,:) = trainingSet1;
allHistograms(2,:,:) = trainingSet2;
allHistograms(3,:,:) = trainingSet3;
Hopefully something in here is helpful. Good luck!
Cheers

More Answers (0)

Community Treasure Hunt

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

Start Hunting!