Transform *make(QString str, QObject *parent)

Make a transform from a string. This function converts the abbreviation characters +, /, {}, <>, and () into their full-length alternatives.

Abbreviation Translation
+ PipeTransform. Each Transform linked by a + is turned into a child of a single PipeTransform. "Example1+Example2" becomes "Pipe([Example1,Example2])". Templates are projected through the children of a pipe in series, the output of one become the input of the next.
/ ForkTransform. Each Transform linked by a / is turned into a child of a single ForkTransform. "Example1/Example2" becomes "Fork([Example1,Example2])". Templates are projected the children of a fork in parallel, each receives the same input and the outputs are merged together.
{} CacheTransform. Can only surround a single Transform. "{Example}" becomes "Cache(Example)". The results of a cached Transform are stored in a global cache using the file name as a key.
<> LoadStoreTransform. Can only surround a single Transform. "" becomes "LoadStore(Example)". Serialize and store a Transform after training or deserialize and load a Transform before projecting.
() Order of operations. Change the order of operations using parantheses.

The parsed string is then passed to Factory::make to be turned into a transform.

  • function definition:

    static Transform *make(QString str, QObject *parent)
    
  • parameters:

    Parameter Type Description
    str QString String describing the transform
    parent QObject * Parent of the object to be created
  • output: (Transform *) Returns a pointer to the Transform described by the string

  • see: Factory::make
  • example:
    Transform::make("Example1+Example2+<ModelFile>")->description(); // returns "Pipe(transforms=[Example1,Example2,LoadStore(ModelFile)])".
    

QSharedPointer<Transform> fromAlgorithm(const QString &algorithm, bool preprocess=false)

Create a Transform from an OpenBR algorithm string. The Transform is created using everything to the left of a : or a ! in the string.

  • function definition:

    static QSharedPointer<Transform> fromAlgorithm(const QString &algorithm, bool preprocess=false)
    
  • parameters:

    Parameter Type Description
    algorithm const QString & Algorithm string to construct the Transform from
    preprocess bool (Optional) If true add a StreamTransform as the parent of the constructed Transform. Default is false.
  • output: (QSharedPointer<Transform>) Returns a pointer to the Transform described by the algorithm.

  • example:

    Transform::fromAlgorithm("EnrollmentTransform:Distance")->decription(); // returns "EnrollmentTransform" Transform::fromAlgorithm("EnrollmentTransform!DistanceTransform")->decription(); // returns "EnrollmentTransform" Transform::fromAlgorithm("EnrollmentTransform")->decription(); // returns "EnrollmentTransform"

QSharedPointer<Transform> fromComparison(const QString &algorithm)

Create aTransform from an OpenBR algorithm string. The Transform is created using everything to the right of a : or a ! in the string. If the separating symbol is a : the string to the right describes a distance. It is converted to a GalleryCompareTransform with the distance stored as a property. If the separating symbol is a ! the string already describes a transform and is unchanged.

  • function definition:

    static QSharedPointer<Transform> fromComparison(const QString &algorithm)
    
  • parameters:

    Parameter Type Description
    algorithm const QString & Algorithm string to construct the Transform from
  • output: (QSharedPointer<Transform>) Returns a pointer to the Transform described by the algorithm.

  • example:
    Transform::fromAlgorithm("EnrollmentTransform:Distance")->description(); // returns "GalleryCompare(distance=Distance)""
    Transform::fromAlgorithm("EnrollmentTransform!DistanceTransform"); // returns "DistanceTransform"
    

Transform *deserialize(QDataStream &stream)

Deserialize a Transform from a stream.

  • function definition:

    static Transform *deserialize(QDataStream &stream)
    
  • parameters:

    Parameter Type Description
    stream QDataStream & Stream containing the serialized transform
  • output: (Transform *) Returns the deserialized transform

Template &operator>>(Template &srcdst, const Transform &f)

Convenience function for project

  • function definition:

    inline Template &operator>>(Template &srcdst, const Transform &f)
    
  • parameters:

    Parameter Type Description
    srcdst Template & Input template. Will be overwritten with the output following call to project
    f const Transform & Transform to project through.
  • output: (Template &) Returns the output of f::project

  • example:
    Template t("picture1.jpg");
    Transform *transform = Transform::make("Example", NULL);
    
    t >> *transform; // projects t through Example. t is overwritten with the output of the project call
    

TemplateList &operator>>(TemplateList &srcdst, const Transform &f)

Convenience function for project

  • function definition:

    inline TemplateList &operator>>(TemplateList &srcdst, const Transform &f)
    
  • parameters:

    Parameter Type Description
    srcdst TemplateList & Input templates. Will be overwritten with the output following call to project
    f const Transform & Transform to project through.
  • output: (TemplateList &) Returns the output of f::project

  • example:
    TemplateList tList(QList<Template>() << Template("picture1.jpg"));
    Transform *transform = Transform::make("Example", NULL);
    
    tList >> *transform; // projects tList through Example. tList is overwritten with the output of the project call
    

QDataStream &operator<<(QDataStream &stream, const Transform &f)

Convenience function for store

  • function definition:

    inline QDataStream &operator<<(QDataStream &stream, const Transform &f)
    
  • parameters:

    Parameter Type Description
    stream QDataStream & Stream to store the transform in
    f const Transform & Transform to be stored
  • output: (QDataStream &) Returns the stream with the transform stored in it

  • example:
    Transform *transform = Transform::make("Example(property1=value1,property2=value2)");
    
    QDataStream stream;
    stream << *transform; // stores "Example(property1=value1,property2=value2)" in the stream
    

QDataStream &operator>>(QDataStream &stream, const Transform &f)

Convenience function for load

  • function definition:

    inline QDataStream &operator>>(QDataStream &stream, const Transform &f)
    
  • parameters:

    Parameter Type Description
    stream QDataStream & Stream to load the transform from
    f const Transform & Transform to store loaded information
  • output: (QDataStream &) Returns the stream without the transform data

  • example:
    Transform *in = Transform::make("Example(property1=value1,property2=value2)");
    
    QDataStream stream;
    stream << *in; // stores "Example(property1=value1,property2=value2)" in the stream
    
    Transform out;
    stream >> out;
    out->description(); // returns "Example(property1=value1,property2=value2)"