SIFT features extraction from images and send it to CNN or other classifiers
1 view (last 30 days)
Show older comments
Good day,
I have been strugling for days with the following code:
- imds = imageDatastore('mydata','IncludeSubfolders',true,'LabelSource','foldernames');
- numImages = numel(imds.Files);
- for i = 1:numImages
- img = readimage(imds,i); img = im2gray(img);
- img = imbinarize(img); % points = detectSIFTFeatures(img);
- hogFeatures(i, :) = extractHOGFeatures(img,'CellSize',cellSize);
- end
........... The above code is part of MATLAB help, and works well for my data that contains arabic alphabets one per image. (sample attached).. I have little code to convert these features to an .csv file from a code of SVM classifier or a CNN reads features from the .csv file and does the classification.
When I want to do the same for SIFT features, instead of HOG, the code becomes as:
----------------
- imds = imageDatastore('mydata','IncludeSubfolders',true,'LabelSource','foldernames');
- numImages = numel(imds.Files);
- for i = 1:20
- img = readimage(imds,i); img = im2gray(img);
- img = imbinarize(img); points = detectSIFTFeatures(img);
- SiftFeatures (i, :) = extractFeatures(img,locations);
- end
.................................line 6 generates and error that this type of indexing is not allowed in this type of objects.I can see the SiftFeatures object has complex nested list of variables (7 varibales ) of different dimensions and their inner dimension vary with every images.
my questions are:
- How to convert this data in a feature vector to save it as .csv file or any other suitable form a CNN can read it.
- What features I must take (scale, orentation, octave ..... etc) for better classififcation, or I need to pick all of them.
thanks in advance.
Shahid B.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!