Into

Modules

Documentation

classPiiTemplateMatcher

#include <PiiTemplateMatcher.h>

Correlates a template against an image.

Inherits PiiDefaultOperation

Description

This operation uses cvMatchTemplate() for matching. It is mostly an illustration on how to integrate OpenCV to Into and not intended for production-grade applications.

Inputs

imagethe input image. Any gray-scale image.

Outputs

correlationa matrix in which each element denotes the correlation (or difference) between the input image and the template. If SquaredDiff or NormedSquaredDiff method is used, smaller values mean better matches. If any other method is used, larger values mean better matches. If the size of the input image is R x C, and the size of the template is r x c, the size of the correlation matrix will be R-r+1 x C-c+1. If the input image is smaller than the template, an empty matrix will be emitted. (PiiMatrix<float>)
maska binary matrix in which a mask (maskFile) is placed on each correlation peak. If mask has not been set, a matrix with correlation peaks will be emitted. The size of the mask is equal to the size of the input image. (PiiMatrix<bool>)

Properties

The name of the mask file.

Matching method.

The name of the template file.

double

Detection threshold.

Public types

enum
{ SquaredDiff, NormalizedSquaredDiff, CrossCorrelation, NormalizedCrossCorrelation, CorrelationCoeff, NormalizedCorrelationCoeff }

Different matching methods.

Constructors and destructor

Public member functions

void
( )
void
void
( )
void
(
  • double threshold
)
double

Protected member functions

virtual void

Executes one round of processing.

Property details

  • QString maskFile

    [read, write]

    The name of the mask file.

    Mask is a binary image that describes the interesting parts of template (the ROI). Once the template matching has succeeded, the mask is placed on each peak, and the result is emitted to the mask output. Non-zero values in the mask are regarded as true. The size of the mask must be equal to the size of the template.

  • MatchingMethod matchingMethod

    [read, write]

    Matching method.

    The default is SquaredDiff.

  • QString templateFile

    [read, write]

    The name of the template file.

    Set this property to load the image template from a file.

  • double threshold

    [read, write]

    Detection threshold.

    All correlation values above (for correlation-based measurements) or below (for squared diff) this threshold are considered matches. The default is 1.0.

Enumeration details

  • enum MatchingMethod

    Different matching methods.

    Names should stand for themselves. *Diff methods produce small values for good matches. Others produce large values for good matches.

Function details

  • PiiTemplateMatcher

    ()
  • ~PiiTemplateMatcher

    ()
  • QString maskFile

    ()
  • MatchingMethod matchingMethod

    ()
  • void setMaskFile

    ( )
  • void setMatchingMethod

    ( )
  • void setTemplateFile

    ( )
  • void setThreshold

    (
    • double threshold
    )
  • QString templateFile

    ()
  • double threshold

    ()
  • virtual void process

    ()
    [protected, virtual]

    Executes one round of processing.

    This function is invoked by the processor if the necessary preconditions for a new processing round are met. This function does all the necessary calculations to create output objects and sends them to output sockets.

    Calls to process(), syncEvent(), and setProperty() are synchronized and cannot occur simultaneously. PiiDefaultOperation ensures this by locking processLock() for reading before calling process().

    Note: With time-consuming operations, one should occasionally check that the operation hasn't been interrupted, i.e. that state() returns Running.

    Exceptions
    PiiExecutionException

    whenever an unrecoverable error occurs during a processing round, the operation is interrupted, or finishes execution due to end of input data.

    Reimplemented from PiiDefaultOperation.

Notes (0)

Add a note

Not a single note added yet. Be the first, add yours.