Creating Image Datastore as a struct for codegen throwing an error
이전 댓글 표시
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?
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Category Classification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!