cv::linemod::Detector Class ReferenceRGB-Depth Processing
Object detector using the LINE template matching algorithm with any set of modalities. More...
#include <opencv2/rgbd/linemod.hpp>
Public Member Functions | |
Object detector using the LINE template matching algorithm with any set of modalities. More...
#include <opencv2/rgbd/linemod.hpp>
Public Member Functions | |
| Detector () |
| Empty constructor, initialize with read(). |
| Detector (const std::vector< Ptr< Modality > > &modalities, const std::vector< int > &T_pyramid) |
| Constructor. |
| int | addSyntheticTemplate (const std::vector< Template > &templates, const String &class_id) |
| Add a new object template computed by external means. |
| int | addTemplate (const std::vector< Mat > &sources, const String &class_id, const Mat &object_mask, Rect *bounding_box=NULL) |
| Add new object template. |
| std::vector< String > | classIds () const |
| const std::vector< Ptr< Modality > > & | getModalities () const |
| Get the modalities used by this detector. |
| int | getT (int pyramid_level) const |
| Get sampling step T at pyramid_level. |
| const std::vector< Template > & | getTemplates (const String &class_id, int template_id) const |
| Get the template pyramid identified by template_id. |
| void | match (const std::vector< Mat > &sources, float threshold, std::vector< Match > &matches, const std::vector< String > &class_ids=std::vector< String >(), OutputArrayOfArrays quantized_images=noArray(), const std::vector< Mat > &masks=std::vector< Mat >()) const |
| Detect objects by template matching. |
| int | numClasses () const |
| int | numTemplates () const |
| int | numTemplates (const String &class_id) const |
| int | pyramidLevels () const |
| Get number of pyramid levels used by this detector. |
| void | read (const FileNode &fn) |
| String | readClass (const FileNode &fn, const String &class_id_override="") |
| void | readClasses (const std::vector< String > &class_ids, const String &format="templates_%s.yml.gz") |
| void | write (FileStorage &fs) const |
| void | writeClass (const String &class_id, FileStorage &fs) const |
| void | writeClasses (const String &format="templates_%s.yml.gz") const |
Protected Types | |
| typedef std::vector< Mat > | LinearMemories |
| typedef std::vector< std::vector< LinearMemories > > | LinearMemoryPyramid |
| typedef std::vector< Template > | TemplatePyramid |
| typedef std::map< String, std::vector< TemplatePyramid > > | TemplatesMap |
Protected Member Functions | |
| void | matchClass (const LinearMemoryPyramid &lm_pyramid, const std::vector< Size > &sizes, float threshold, std::vector< Match > &matches, const String &class_id, const std::vector< TemplatePyramid > &template_pyramids) const |
Protected Attributes | |
| TemplatesMap | class_templates |
| std::vector< Ptr< Modality > > | modalities |
| int | pyramid_levels |
| std::vector< int > | T_at_level |
Object detector using the LINE template matching algorithm with any set of modalities.
| protected |
| protected |
| protected |
| protected |
| cv::linemod::Detector::Detector | ( | ) |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector( | ) -> | <linemod_Detector object> | ||
| cv.linemod.Detector( | modalities, T_pyramid | ) -> | <linemod_Detector object> |
Empty constructor, initialize with read().
| cv::linemod::Detector::Detector | ( | const std::vector< Ptr< Modality > > & | modalities, |
| const std::vector< int > & | T_pyramid ) |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector( | ) -> | <linemod_Detector object> | ||
| cv.linemod.Detector( | modalities, T_pyramid | ) -> | <linemod_Detector object> |
Constructor.
| modalities | Modalities to use (color gradients, depth normals, ...). |
| T_pyramid | Value of the sampling step T at each pyramid level. The number of pyramid levels is T_pyramid.size(). |
| int cv::linemod::Detector::addTemplate | ( | const std::vector< Mat > & | sources, |
| const String & | class_id, | ||
| const Mat & | object_mask, | ||
| Rect * | bounding_box = NULL ) |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.addTemplate( | sources, class_id, object_mask | ) -> | retval, bounding_box |
Add new object template.
| sources | Source images, one for each modality. | |
| class_id | Object class ID. | |
| object_mask | Mask separating object from background. | |
| [out] | bounding_box | Optionally return bounding box of the extracted features. |
| std::vector< String > cv::linemod::Detector::classIds | ( | ) | const |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.classIds( | ) -> | retval |
| inline |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.getT( | pyramid_level | ) -> | retval |
Get sampling step T at pyramid_level.
| const std::vector< Template > & cv::linemod::Detector::getTemplates | ( | const String & | class_id, |
| int | template_id ) const |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.getTemplates( | class_id, template_id | ) -> | retval |
Get the template pyramid identified by template_id.
For example, with 2 modalities (Gradient, Normal) and two pyramid levels (L0, L1), the order is (GradientL0, NormalL0, GradientL1, NormalL1).
| void cv::linemod::Detector::match | ( | const std::vector< Mat > & | sources, |
| float | threshold, | ||
| std::vector< Match > & | matches, | ||
| const std::vector< String > & | class_ids = std::vector< String >(), | ||
| OutputArrayOfArrays | quantized_images = noArray(), | ||
| const std::vector< Mat > & | masks = std::vector< Mat >() ) const |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.match( | sources, threshold[, class_ids[, quantized_images[, masks]]] | ) -> | matches, quantized_images |
Detect objects by template matching.
Matches globally at the lowest pyramid level, then refines locally stepping up the pyramid.
| sources | Source images, one for each modality. | |
| threshold | Similarity threshold, a percentage between 0 and 100. | |
| [out] | matches | Template matches, sorted by similarity score. |
| class_ids | If non-empty, only search for the desired object classes. |
| protected |
| inline |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.numClasses( | ) -> | retval |
| int cv::linemod::Detector::numTemplates | ( | ) | const |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.numTemplates( | ) -> | retval | ||
| cv.linemod.Detector.numTemplates( | class_id | ) -> | retval |
| int cv::linemod::Detector::numTemplates | ( | const String & | class_id | ) | const |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.numTemplates( | ) -> | retval | ||
| cv.linemod.Detector.numTemplates( | class_id | ) -> | retval |
| inline |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.pyramidLevels( | ) -> | retval |
Get number of pyramid levels used by this detector.
| void cv::linemod::Detector::read | ( | const FileNode & | fn | ) |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.read( | fn | ) -> | None |
| void cv::linemod::Detector::write | ( | FileStorage & | fs | ) | const |
| void cv::linemod::Detector::writeClass | ( | const String & | class_id, |
| FileStorage & | fs ) const |
| void cv::linemod::Detector::writeClasses | ( | const String & | format = "templates_%s.yml.gz" | ) | const |
| Python: | ||||
|---|---|---|---|---|
| cv.linemod.Detector.writeClasses( | [, format] | ) -> | None |
| protected |
| protected |
| protected |
| [out] | quantized_images | Optionally return vector<Mat> of quantized images. |
| masks | The masks for consideration during matching. The masks should be CV_8UC1 where 255 represents a valid pixel. If non-empty, the vector must be the same size as sources. Each element must be empty or the same size as its corresponding source. |