Create bagofFeatures for code generation

1 view (last 30 days)
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
Anush
Anush on 20 Jun 2023
You can try checking out the code with:
edit bagOfFeatures.m
Sahithi Kanumarlapudi
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.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!