Main Content

toStruct

Convert a trained aggregate channel features (ACF) object detector into structure

Description

detectorStruct = toStruct(acfObjectDetector) returns a structure that stores the properties of the input acfObjectDetector object in fields. The output structure contains fields Classifier and TrainingOptions. Use the structure to create an identical acfObjectDetector object for C code generation. You can call the toStruct, and then pass the resulting structure to a MATLAB function, which recreates the acfObjectDetector object.

example

Examples

collapse all

Load the pretrained ACF stop sign detector from the stopSignDetector.mat file, which is present in the current working folder as a supporting file.

stopSignDetector= load('stopSignDetectorACF.mat');
detector = stopSignDetector.detector
detector = 

  acfObjectDetector with properties:

             ModelName: 'stopSign'
    ObjectTrainingSize: [34 31]
       NumWeakLearners: 61

Convert the detector to a structure.

detectorStruct = toStruct(detector)
detectorStruct = 

  struct with fields:

             ModelName: 'stopSign'
    ObjectTrainingSize: [34 31]
       NumWeakLearners: 61
            Classifier: [1x1 struct]
       TrainingOptions: [1x1 struct]

Input Arguments

collapse all

ACF object detector, specified as an acfObjectDetector object. To create this object, call the trainACFObjectDetector function with training data as input.

Output Arguments

collapse all

ACF object detector, returned as a structure containing the object properties into fields.