Image Classification: Color Histogram & KNN classifer
6 次查看(过去 30 天)
显示 更早的评论
Hello,
I want to classify an image through the use of color histograms and knn classifer. I have a dataset of 100 images for each class (butterfly, dog, cat) in a folder. My understanding of the problem is as follows:
1) read in images to create a color histogram for each (RGB)
2) find the kmeans for RGB for each image
3) cluster the kmeans points separately for each class and find its centroid (so for the butterfly class, each image gives me kmeans value for R, G, B. I plot all the R kmeans values and find the centroid, same with G and B.)
4) Read in test image, create a color histogram, find the kmeans value for RGB, then use the Euclidean distance for each kmeans to find the nearest cluster for R,G,B.
Is this how it is supposed to be done or am I not understanding this correctly?
0 个评论
采纳的回答
Nalini Vishnoi
2015-5-4
Hi Dennis,
The steps in your algorithm seem correct. However, when you are doing k-means clustering a lot of information is lost and for practical purposes, color histograms may not be strong enough to discriminate various classes (it would be heavily dependent on your data set). It might be useful to consider adding additional features, for example: texture, shape etc. These features combined together would capture unique information about the classes that need to be distinguished from each other.
2 个评论
Nalini Vishnoi
2015-5-5
If you are just finding the mean value, the algorithms is NN/1-NN (nearest neighbor) rather than K-NN. The mean and the centroid should be the same. You may find this link useful.
更多回答(1 个)
Image Analyst
2015-5-5
There is no way that will correctly classify the animals UNLESS all your cats are the "same" color, all the dogs are the "same" color, and all the butterflies are the same color, and there is little other clutter in the background. If you assumed all your cats were black, and all your butterflies were orange and black monarchs, and you presented an orange/ginger tabby cat, your algorithm might say the cat was a butterfly.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!