BOWTrainer

Objective-C

@interface BOWTrainer : NSObject

Swift

class BOWTrainer : NSObject

Abstract base class for training the bag of visual words vocabulary from a set of descriptors.

For details, see, for example, Visual Categorization with Bags of Keypoints by Gabriella Csurka, Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :

Member of Features2d

Methods

  • Clusters train descriptors.

    Declaration

    Objective-C

    - (nonnull Mat *)cluster:(nonnull Mat *)descriptors;

    Swift

    func cluster(descriptors: Mat) -> Mat

    Parameters

    descriptors

    Descriptors to cluster. Each row of the descriptors matrix is a descriptor. Descriptors are not added to the inner train descriptor set.

    The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first variant of the method, train descriptors stored in the object are clustered. In the second variant, input descriptors are clustered.

  • Declaration

    Objective-C

    - (Mat*)cluster NS_SWIFT_NAME(cluster());

    Swift

    func cluster() -> Mat
  • Returns the count of all descriptors stored in the training set.

    Declaration

    Objective-C

    - (int)descriptorsCount;

    Swift

    func descriptorsCount() -> Int32
  • Returns a training set of descriptors.

    Declaration

    Objective-C

    - (nonnull NSArray<Mat *> *)getDescriptors;

    Swift

    func getDescriptors() -> [Mat]
  • Adds descriptors to a training set.

    Declaration

    Objective-C

    - (void)add:(nonnull Mat *)descriptors;

    Swift

    func add(descriptors: Mat)

    Parameters

    descriptors

    Descriptors to add to a training set. Each row of the descriptors matrix is a descriptor.

    The training set is clustered using clustermethod to construct the vocabulary.

  • Declaration

    Objective-C

    - (void)clear NS_SWIFT_NAME(clear());

    Swift

    func clear()