Table Of Contents

Previous topic

Binary descriptors for lines extracted from an image

Next topic

Line Segments Detector

BinaryDescriptor Class

BinaryDescriptor Class implements both functionalities for detection of lines and computation of their binary descriptor. Class’ interface is mainly based on the ones of classical detectors and extractors, such as Feature2d’s FeatureDetector and DescriptorExtractor. Retrieved information about lines is stored in KeyLine objects.

BinaryDescriptor::Params

struct BinaryDescriptor::Params

List of BinaryDescriptor parameters:

struct CV_EXPORTS_W_SIMPLE Params{
        CV_WRAP Params();

        /* the number of image octaves (default = 1) */
        CV_PROP_RW int  numOfOctave_;

        /* the width of band; (default = 7) */
        CV_PROP_RW int  widthOfBand_;

        /* image's reduction ratio in construction of Gaussian pyramids (default = 2) */
        CV_PROP_RW int reductionRatio;

        /* read parameters from a FileNode object and store them (struct function) */
        void read( const FileNode& fn );

        /* store parameters to a FileStorage object (struct function) */
        void write( FileStorage& fs ) const;

    };

BinaryDescriptor::BinaryDescriptor

Constructor

C++: bool BinaryDescriptor::BinaryDescriptor(const BinaryDescriptor::Params& parameters=BinaryDescriptor::Params() )
Parameters:

If no argument is provided, constructor sets default values (see comments in the code snippet in previous section). Default values are strongly reccomended.

BinaryDescriptor::getNumOfOctaves

Get current number of octaves

C++: int BinaryDescriptor::getNumOfOctaves()

BinaryDescriptor::setNumOfOctaves

Set number of octaves

C++: void BinaryDescriptor::setNumOfOctaves(int octaves)
Parameters:
  • octaves – number of octaves

BinaryDescriptor::getWidthOfBand

Get current width of bands

C++: int BinaryDescriptor::getWidthOfBand()

BinaryDescriptor::setWidthOfBand

Set width of bands

C++: void BinaryDescriptor::setWidthOfBand(int width)
Parameters:
  • width – width of bands

BinaryDescriptor::getReductionRatio

Get current reduction ratio (used in Gaussian pyramids)

C++: int BinaryDescriptor::getReductionRatio()

BinaryDescriptor::setReductionRatio

Set reduction ratio (used in Gaussian pyramids)

C++: void BinaryDescriptor::setReductionRatio(int rRatio)
Parameters:
  • rRatio – reduction ratio

BinaryDescriptor::createBinaryDescriptor

Create a BinaryDescriptor object with default parameters (or with the ones provided) and return a smart pointer to it

C++: Ptr<BinaryDescriptor> BinaryDescriptor::createBinaryDescriptor()
C++: Ptr<BinaryDescriptor> BinaryDescriptor::createBinaryDescriptor(Params parameters)

BinaryDescriptor::operator()

Define operator ‘()’ to perform detection of KeyLines and computation of descriptors in a row.

C++: void BinaryDescriptor::operator()(InputArray image, InputArray mask, vector<KeyLine>& keylines, OutputArray descriptors, bool useProvidedKeyLines=false, bool returnFloatDescr) const
Parameters:
  • image – input image
  • mask – mask matrix to select which lines in KeyLines must be accepted among the ones extracted (used when keylines is not empty)
  • keylines – vector that contains input lines (when filled, the detection part will be skipped and input lines will be passed as input to the algorithm computing descriptors)
  • descriptors – matrix that will store final descriptors
  • useProvidedKeyLines – flag (when set to true, detection phase will be skipped and only computation of descriptors will be executed, using lines provided in keylines)
  • returnFloatDescr – flag (when set to true, original non-binary descriptors are returned)

BinaryDescriptor::read

Read parameters from a FileNode object and store them

C++: void BinaryDescriptor::read(const FileNode& fn)
Parameters:
  • fn – source FileNode file

BinaryDescriptor::write

Store parameters to a FileStorage object

C++: void BinaryDescriptor::write(FileStorage& fs) const
Parameters:
  • fs – output FileStorage file

BinaryDescriptor::defaultNorm

Return norm mode

C++: int BinaryDescriptor::defaultNorm() const

BinaryDescriptor::descriptorType

Return data type

C++: int BinaryDescriptor::descriptorType() const

BinaryDescriptor::descriptorSize

Return descriptor size

C++: int BinaryDescriptor::descriptorSize() const

BinaryDescriptor::detect

Requires line detection (for one or more images)

C++: void detect(const Mat& image, vector<KeyLine>& keylines, Mat& mask=Mat() )
C++: void detect(const vector<Mat>& images, vector<vector<KeyLine>>& keylines, vector<Mat>& masks=vector<Mat>() ) const
Parameters:
  • image – input image
  • images – input images
  • keylines – vector or set of vectors that will store extracted lines for one or more images
  • mask – mask matrix to detect only KeyLines of interest
  • masks – vector of mask matrices to detect only KeyLines of interest from each input image

BinaryDescriptor::compute

Requires descriptors computation (for one or more images)

C++: void compute(const Mat& image, vector<KeyLine>& keylines, Mat& descriptors, bool returnFloatDescr) const
C++: void compute(const vector<Mat>& images, vector<vector<KeyLine>>& keylines, vector<Mat>& descriptors, bool returnFloatDescr) const
Parameters:
  • image – input image
  • images – input images
  • keylines – vector or set of vectors containing lines for which descriptors must be computed
  • mask – mask to select for which lines, among the ones provided in input, descriptors must be computed
  • masks – set of masks to select for which lines, among the ones provided in input, descriptors must be computed
  • returnFloatDescr – flag (when set to true, original non-binary descriptors are returned)