フィルターのクリア

How to convert histogram data into Matrices

1 回表示 (過去 30 日間)
Mansell Teh
Mansell Teh 2016 年 11 月 5 日
回答済み: Image Analyst 2016 年 11 月 5 日
Dear all,
I am currently working with face recognition. Ive detected the face, extracted the feature with lbp and retrieved the normalized histogram. Now for the final step, which is classification, I need to compare both training and testing image by using k-nearest neighbor classification. But k-nearest neighbor only compares matrix.
So the problem here is, how do i turn the histogram data into matrices in order for me to compare them. Ive attached two files, which one is for training image and one is for testing image.

回答 (1 件)

Image Analyst
Image Analyst 2016 年 11 月 5 日
I doubt you'd want to use the entire histogram. You might want to extract just a few numbers characteristic of this histogram. Then put them into different columns of your matrix. The X and Y in knnsearch are arrays where "Rows of X correspond to observations and columns correspond to variables." So if you measures lbp features lbpa, lbpb, lbpc and histogram features mu and sigma, then you'd construct X and Y like this
X = [lbpa, lbpb, lbpc, mu, sigma];
Where those things are each column vectors where you have 1 observation per image. So if you had 1000 images, lbpa, lbpb, lbpc, mu, and sigma would all be column vectors of 1000 elements.
If you had the whole histogram in every row, you'd have 3 LBP measurements and 256 histogram measurements and that would inordinately bias the results towards what the histogram is suggesting, essentially ignoring the LBP values since there is only 3 of them vs. 256 of the histogram values.

Community Treasure Hunt

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

Start Hunting!

Translated by