Creating Image Datastore as a struct for codegen throwing an error
Afficher commentaires plus anciens
Hi,
I am trying to create an ImageDatastore object to initialize a bag of features and then run codegen on it. Documentation says I can create it as a struct but it still throws an error.
images = cell(numImages, 1);
labels = cell(numImages, 1);
for k = 0:numImages-1
filename = fullfile(imageFolder, sprintf('%04d.jpg', int32(k)));
images{k+1} = imread(filename);
labels{k+1} = sprintf('%04d.jpg', int32(k));
end
imds.Images = images;
imds.Labels = categorical(labels);
bag = bagOfFeatures(imds, 'CustomExtractor',CustomFeatureExtractor, ...
bowParams{:});
This is the error I get:
- It no longer gives me an error on codegen.
- It doesn't work with regular execution.
Error using bagOfFeatures/parseInputs (line 1005)
The value of 'imds' is invalid. Expected imds to be one of these types:
matlab.io.datastore.ImageDatastore
Instead its type was struct.
Error in
bagOfFeatures (line 119)
[imgSets, params] = bagOfFeatures.parseInputs(varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
main_vSLAM_VisualHull_RaspPi (line 283)
bag = bagOfFeatures(imds, 'CustomExtractor',CustomFeatureExtractor, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Am I doing something wrong here?
Réponses (0)
Catégories
En savoir plus sur Image Category Classification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!