Class Detector
Object detector using the LINE template matching algorithm with any set of modalities.
public abstract class Detector : SharedPtrObject, IDisposable
- Inheritance
-
Detector
- Implements
- Derived
- Inherited Members
Constructors
Detector()
protected Detector()
Properties
ClassIds
Get class ids
public string[] ClassIds { get; }
Property Value
- string[]
Modalities
Get the modalities used by this detector. You are not permitted to add/remove modalities, but you may cast them to tweak parameters.
public Modality[] Modalities { get; }
Property Value
- Modality[]
NumClasses
Get number of classes.
public int NumClasses { get; }
Property Value
NumTemplates
Get number of templates.
public int NumTemplates { get; }
Property Value
PyramidLevels
Get number of pyramid levels used by this detector.
public int PyramidLevels { get; }
Property Value
Methods
AddTemplate(VectorOfMat, string, Mat, ref Rectangle)
Add new object template.
public int AddTemplate(VectorOfMat sources, string classId, Mat objectMask, ref Rectangle boundingBox)
Parameters
sources
VectorOfMatSource images, one for each modality.
classId
stringObject class ID.
objectMask
MatMask separating object from background.
boundingBox
RectangleReturn bounding box of the extracted features.
Returns
- int
Template ID, or -1 if failed to extract a valid template.
DisposeObject()
Release the unmanaged memory associated with this object
protected override void DisposeObject()
GetT(int)
Get sampling step T at pyramidLevel
.
public int GetT(int pyramidLevel)
Parameters
pyramidLevel
intThe pyramid level
Returns
- int
Sampling step T
Match(VectorOfMat, float, VectorOfLinemodMatch, VectorOfCvString, IOutputArrayOfArrays, VectorOfMat)
Detect objects by template matching. Matches globally at the lowest pyramid level, then refines locally stepping up the pyramid.
public void Match(VectorOfMat sources, float threshold, VectorOfLinemodMatch matches, VectorOfCvString classIds = null, IOutputArrayOfArrays quantizedImages = null, VectorOfMat masks = null)
Parameters
sources
VectorOfMatSource images, one for each modality.
threshold
floatSimilarity threshold, a percentage between 0 and 100.
matches
VectorOfLinemodMatchTemplate matches, sorted by similarity score.
classIds
VectorOfCvStringIf non-empty, only search for the desired object classes.
quantizedImages
IOutputArrayOfArraysOptionally return vector<Mat> of quantized images.
masks
VectorOfMatThe 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.
Read(FileNode)
Read the detector from file node
public void Read(FileNode fn)
Parameters
fn
FileNodeThe file node to read the detector from
Write(FileStorage)
Write the detector to file storage
public void Write(FileStorage fs)
Parameters
fs
FileStorageThe file storage to write the detector into.