Class cv::linemod::Detector#

Object detector using the LINE template matching algorithm with any set of modalities.

Collaboration diagram for cv::linemod::Detector:

cv::linemod::Detector Node1 cv::linemod::Detector   + Detector() + Detector() + addSyntheticTemplate() + addTemplate() + classIds() + getModalities() + getT() + getTemplates() + match() + numClasses() and 9 more... # matchClass() Node2 std::vector< Ptr< cv ::linemod::Modality > >     Node2->Node1 #modalities Node3 Ptr< cv::linemod::Modality >     Node3->Node2 +elements Node4 std::vector< T >     Node4->Node2 < Ptr< cv::linemod ::Modality > > Node7 std::vector< int >     Node4->Node7 < int > Node11 std::vector< TemplatePyramid >     Node4->Node11 +elements Node4->Node11 < TemplatePyramid > Node5 T     Node5->Node4 +elements Node12 std::map< K, T >     Node5->Node12 +elements Node6 int     Node6->Node1 #pyramid_levels Node6->Node7 +elements Node7->Node1 #T_at_level Node8 std::map< String, std ::vector< TemplatePyramid > >     Node8->Node1 #class_templates Node9 std::string     Node9->Node8 +keys Node10 std::basic_string< Char >     Node10->Node9 Node11->Node8 +elements Node12->Node8 < String, std::vector < TemplatePyramid > > Node13 K     Node13->Node12 +keys

cv::linemod::Detector Node1 cv::linemod::Detector   + Detector() + Detector() + addSyntheticTemplate() + addTemplate() + classIds() + getModalities() + getT() + getTemplates() + match() + numClasses() and 9 more... # matchClass() Node2 std::vector< Ptr< cv ::linemod::Modality > >     Node2->Node1 #modalities Node3 Ptr< cv::linemod::Modality >     Node3->Node2 +elements Node4 std::vector< T >     Node4->Node2 < Ptr< cv::linemod ::Modality > > Node7 std::vector< int >     Node4->Node7 < int > Node11 std::vector< TemplatePyramid >     Node4->Node11 +elements Node4->Node11 < TemplatePyramid > Node5 T     Node5->Node4 +elements Node12 std::map< K, T >     Node5->Node12 +elements Node6 int     Node6->Node1 #pyramid_levels Node6->Node7 +elements Node7->Node1 #T_at_level Node8 std::map< String, std ::vector< TemplatePyramid > >     Node8->Node1 #class_templates Node9 std::string     Node9->Node8 +keys Node10 std::basic_string< Char >     Node10->Node9 Node11->Node8 +elements Node12->Node8 < String, std::vector < TemplatePyramid > > Node13 K     Node13->Node12 +keys

Detailed Description#

Object detector using the LINE template matching algorithm with any set of modalities.

Examples
samples/peopledetect.cpp, samples/cpp/tutorial_code/ImgTrans/Sobel_Demo.cpp, samples/dnn/text_detection.cpp, and samples/python/snippets/squares.py.

Member Typedef Documentation#

LinearMemories#

typedef std::vector< Mat > cv::linemod::Detector::LinearMemories

LinearMemoryPyramid#

typedef std::vector< std::vector< LinearMemories > > cv::linemod::Detector::LinearMemoryPyramid

TemplatePyramid#

typedef std::vector< Template > cv::linemod::Detector::TemplatePyramid

TemplatesMap#

typedef std::map< String, std::vector< TemplatePyramid > > cv::linemod::Detector::TemplatesMap

Constructor & Destructor Documentation#

Detector()#

cv::linemod::Detector::Detector()

Empty constructor, initialize with read().

Detector()#

cv::linemod::Detector::Detector(
const std::vector< Ptr< Modality > > & modalities,
const std::vector< int > & T_pyramid )

Constructor.

Parameters

  • 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().

Member Function Documentation#

addSyntheticTemplate()#

int cv::linemod::Detector::addSyntheticTemplate(
const std::vector< Template > & templates,
const String & class_id )

Add a new object template computed by external means.

addTemplate()#

int cv::linemod::Detector::addTemplate(
const std::vector< Mat > & sources,
const String & class_id,
const Mat & object_mask,
Rect * bounding_box = NULL )

Add new object template.

Parameters

  • sources — Source images, one for each modality.

  • class_id — Object class ID.

  • object_mask — Mask separating object from background.

  • bounding_box — Optionally return bounding box of the extracted features.

Returns

Template ID, or -1 if failed to extract a valid template.

classIds()#

std::vector< String > cv::linemod::Detector::classIds()

getModalities()#

const std::vector< Ptr< Modality > > & cv::linemod::Detector::getModalities()

Get the modalities used by this detector.

You are not permitted to add/remove modalities, but you may dynamic_cast them to tweak parameters.

getT()#

int cv::linemod::Detector::getT(int pyramid_level)

Get sampling step T at pyramid_level.

getTemplates()#

const std::vector< Template > & cv::linemod::Detector::getTemplates(
const String & class_id,
int template_id )

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).

match()#

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 >() )

Detect objects by template matching.

Matches globally at the lowest pyramid level, then refines locally stepping up the pyramid.

Parameters

  • sources — Source images, one for each modality.

  • threshold — Similarity threshold, a percentage between 0 and 100.

  • matchesTemplate matches, sorted by similarity score.

  • class_ids — If non-empty, only search for the desired object classes.

  • quantized_images — Optionally return vector 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.

Here is the call graph for this function:

cv::linemod::Detector::match Node1 cv::linemod::Detector ::match Node2 cv::noArray Node1->Node2

cv::linemod::Detector::match Node1 cv::linemod::Detector ::match Node2 cv::noArray Node1->Node2

numClasses()#

int cv::linemod::Detector::numClasses()

numTemplates()#

int cv::linemod::Detector::numTemplates()

numTemplates()#

int cv::linemod::Detector::numTemplates(const String & class_id)

pyramidLevels()#

int cv::linemod::Detector::pyramidLevels()

Get number of pyramid levels used by this detector.

read()#

void cv::linemod::Detector::read(const FileNode & fn)

readClass()#

String cv::linemod::Detector::readClass(
const FileNode & fn,
const String & class_id_override = “” )

readClasses()#

void cv::linemod::Detector::readClasses(
const std::vector< String > & class_ids,
const String & format = “templates_%s.yml.gz” )

write()#

void cv::linemod::Detector::write(FileStorage & fs)

writeClass()#

void cv::linemod::Detector::writeClass(
const String & class_id,
FileStorage & fs )

writeClasses()#

void cv::linemod::Detector::writeClasses(const String & format = “templates_%s.yml.gz”)

matchClass()#

void cv::linemod::Detector::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 )

Member Data Documentation#

class_templates#

TemplatesMap cv::linemod::Detector::class_templates

modalities#

std::vector< Ptr< Modality > > cv::linemod::Detector::modalities

pyramid_levels#

int cv::linemod::Detector::pyramid_levels

T_at_level#

std::vector< int > cv::linemod::Detector::T_at_level

Source file#

The documentation for this class was generated from the following file: