Create bagofFeatures for code generation
1 view (last 30 days)
Show older comments
I'm trying to create a bagOfFeatures for use in a script that will be compiled to C code. The help page for bagOfFeatures states:
For code generation, the bagOfFeatures function does not support the ImageDatastore object as input. Instead, specify the input as a structure with fields Images and Labels. The Images field must contain a cell array of grayscale or RGB color images. The Labels field must contain image labels stored as categorical arrays.
As a result, I cannot use the constructers of the form
bag = bagOfFeatures(imds)
However, if I try to create a structure imds with fields Images and Labels as suggested, I recieve the following error when I run
bofData = bagOfFeatures(imds);
Error using bagOfFeatures/parseInputs
The value of 'imds' is invalid. Expected imds to be one of these types:
imageSet, matlab.io.datastore.ImageDatastore
Instead its type was struct.
This seems to indicate I cannot pass a structure as suggested - how can I create a bagOfFeatures using the specified input? I don't see a Name/Value pair related to this.
Thanks in advance!
2 Comments
Sahithi Kanumarlapudi
on 8 Sep 2023
Hi Michael,
Could you attach the script that you have used to create the struct and the script you used to do codegen. It would help us in understanding the issue better.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!