Effacer les filtres
Effacer les filtres

Classify binary images with multiple features

5 vues (au cours des 30 derniers jours)
Edward Attard Montalto
Edward Attard Montalto le 6 Avr 2018
I'm trying to classify a set of binary images in matlab. I have created a model using a lot of different images and have classified each one accordingly so that the model 'knows' which images belong to which class. Each image is represent as a feature vector, which is 1x59. I am successfully able to calculate the mean and covariance of class of images. The classifier uses maximum a posterior classification (MAP), but for some reason all the images in the test aren't being classified properly. The long equation I am using in the variable 'score' is the MAP calculation . Does anyone have any suggestions as to how to best classify an image?
function [classname] = classify(imagepath)
%Classify the image specified for the given image path
load('models');
%Assume all models use the same number of features
N = length(models(1).mean);
%(N+1)/2 because features considers positive and negative fourier
%therefore produces double the number of feature vectors
features = getFeatures(imagepath, ((N+1)/2));
maxscore = -inf;
%Find out which class has the highest score
for index = 1:length(models)
model = models(index);
%this should give a probablist score
score = max(log(model.prior) - 0.5*log(abs(model.cov)) - 0.5*(features - model.mean)'*inv(model.cov)*(features - model.mean));
%Score should be a 1x1 array not that monster
if score > maxscore
maxscore = score;
bestindex = index;
end
end
classname = classes(bestindex);
end

Réponses (1)

Prajit T R
Prajit T R le 9 Avr 2018
Hi Edward
The Deep Learning toolbox can help in classifying images with a good accuracy. Check out this link: Image classification using Deep learning There's another documentation link wherein an example with the use of SVM for image classification is given. You may want to try that as well: SVM for Image classification
Hope this helps.
Cheers

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by