SIFT features extraction from images and send it to CNN or other classifiers

3 visualizzazioni (ultimi 30 giorni)
Good day,
I have been strugling for days with the following code:
  1. imds = imageDatastore('mydata','IncludeSubfolders',true,'LabelSource','foldernames');
  2. numImages = numel(imds.Files);
  3. for i = 1:numImages
  4. img = readimage(imds,i); img = im2gray(img);
  5. img = imbinarize(img); % points = detectSIFTFeatures(img);
  6. hogFeatures(i, :) = extractHOGFeatures(img,'CellSize',cellSize);
  7. 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:
----------------
  1. imds = imageDatastore('mydata','IncludeSubfolders',true,'LabelSource','foldernames');
  2. numImages = numel(imds.Files);
  3. for i = 1:20
  4. img = readimage(imds,i); img = im2gray(img);
  5. img = imbinarize(img); points = detectSIFTFeatures(img);
  6. SiftFeatures (i, :) = extractFeatures(img,locations);
  7. 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:
  1. 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.
  2. 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.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by