Image recognition using MATLAB
3 ビュー (過去 30 日間)
古いコメントを表示
I have to take any number of images suppose 5 and have to train the system in a way that when i bring the same image as testing data, it should recognize that which image it is. say i have images of apple, chair, man, car and tree. then if i test it with any different image of (say) apple or car etc. then my system should recognize it is an apple. It is a class project and i just want to know that how should i approach this problem .should i go for feature extraction and if so then what features should i extract from the images for training.
0 件のコメント
回答 (2 件)
Image Analyst
2013 年 5 月 5 日
If, when you said "i bring the same image as testing data" you actually meant "i bring the same image as training data" then this is trivially easy and can be done in a few lines. Simply have one of the features be the mean value of the image. Most likely the 5 images won't have the same mean. So you just calculate the 5 means, and the mean of the test image which you are going to present to the system, and find out which is closest.
% Read in all images
image1 = imread(filename1);
image2 = imread(filename2);
image3 = imread(filename3);
image4 = imread(filename4);
image5 = imread(filename5);
% Get the means
theMeans(1) = mean2(image1);
theMeans(2) = mean2(image2);
theMeans(3) = mean2(image3);
theMeans(4) = mean2(image4);
theMeans(5) = mean2(image5);
% Get mean of test image
testMean = mean2(testImage);
% Find which image it matches:
[minValue, matchingImageIndex] = min(abs(theMeans - testMean));
matchingImageIndex is your answer - it will be a number between 1 and 5, inclusive.
0 件のコメント
Anand
2013 年 5 月 6 日
You could use the 2-D correlation coefficient between the image you send and the images in the training set and select the one with the highest correlation coefficient. Use the corr2 function to do this. Ofcourse, the assumptions Image Analyst made above are valid here too.
1 件のコメント
Image Analyst
2013 年 5 月 6 日
You'd have to use normxcorr2() instead of corr2(), otherwise just some uniform image of 255 will give a higher correlation than the correlation of the image with itself, since it's just multiplying and summing.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!