CVB.Net 14.0
Classifier Class Reference

ShapeFinder classifier object. More...

Inherits ClassifierObject.

Public Member Functions

 Classifier (Classifier other)
 Copy constructor for ShapeFinder classifiers More...
 
 Classifier (string fileName)
 Load a saved classifier from a file. More...
 
SearchResult[] SearchAll (ImagePlane plane, Rect aoi, PrecisionMode mode, int locality, int threshold)
 Search for all matches inside an image plane . More...
 
SearchResult SearchBest (ImagePlane plane, Rect aoi, PrecisionMode mode)
 Search for the best pattern match in the plane More...
 
void DeleteFeatures (Rect window)
 Delete features in a given window from this classifier. More...
 
void TruncateFeatures (int count)
 Shorten the list of classifier features based on each feature's quality. More...
 
void ReverseContrasts ()
 Reverse the contrasts on this ShapeFinder classifier. More...
 
void Append (Classifier clf)
 Append another classifier to this one. Appending means that the layers contained in clf will be appended to the layers of this classifier, so the layers (which may be considered models) of the two classifiers are left unchanged. Note that both classifiers involved must use the same gradient type. More...
 
- Public Member Functions inherited from ClassifierObject
 ClassifierObject (string fileName, string typeName)
 Load a saved classifier from a file. More...
 
void Dispose ()
 IDisposable implementation. More...
 
void Transform (Matrix2D m)
 Transform this ShapeFinder classifier using a 2x2 matrix. More...
 
void Translate (Point2D offset)
 Translate this classifier by a selectable offset . More...
 
void Save (string fileName)
 Write the classifier to a file. More...
 
Image GetVisualization (int layer)
 Create and return a color coded image representation of this ShapeFinder classifier. The colors in the output image correspond to the gradient directions, the positions to the displacement vectors. This visual representation might be useful during interactive supervision and debugging. More...
 
Image GetVisualization ()
 Create and return a color coded image representation of this ShapeFinder classifier. The colors in the output image correspond to the gradient directions, the positions to the displacement vectors. This visual representation might be useful during interactive supervision and debugging. More...
 

Properties

int ContrastThreshold [get, set]
 Threshold for the gradient slope. More...
 
Angle AngularTolerance [get, set]
 Acceptance parameter for feature gradient angles. In ShapeFinder the angle of a feature is quantized into the range [0...255], i.e. in steps of roughly 1.41 degrees. When determining whether features extracted from an image match features stored in a classifier, the gradient's angle of the two features is compared not for strict equality, but for whether or not it falls into a certain range of differences. This acceptance window is defined by the Angular tolerance parameter. Valid values range from 0 (always match for identity only) to 16. More...
 
int FeatureCount [get]
 Number of features this classifier contains. More...
 
- Properties inherited from ClassifierObject
IntPtr Handle [get]
 Native ShapeFinder2 classifier handle. More...
 
string FileName [get]
 Name of the file from which this classifier was loaded (string.Empty if this image list was neither loaded nor saved since its construction). More...
 
bool IsDisposed [get]
 Tests if the native handle has already been disposed.
 
unsafe string Comment [get, set]
 Comment assigned to the classifier. More...
 
GradientType GradientType [get]
 Gradient type this classifier uses for feature extraction. More...
 
Rect FeatureWindow [get]
 Feature window of this classifier (i.e. the bounding rectangle into which all the classifier's features fit) relative to the classifier's origin. More...
 
int NumLayers [get]
 Number of layers in the classifier (and in the accumulator generated by the search function). In ShapeFinder classifiers layers may be associated with specific classes or rotation information. In ShapeFinder2 the layer count is a purely informational value. More...
 
- Properties inherited from INativeHandle
IntPtr Handle [get]
 The native handle of the object.
 
bool IsDisposed [get]
 Possibility to check whether the object has already been disposed of.
 

Additional Inherited Members

- Protected Member Functions inherited from ClassifierObject
virtual void Dispose (bool disposing)
 IDispose helper function. More...
 
- Events inherited from ClassifierObject
NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method.
More...
 
- Events inherited from INativeHandle
NativeHandleEventDelegate ObjectDisposing
 Raised when this object is about to be disposed via the IDisposable.Dispose method.
More...
 

Detailed Description

ShapeFinder classifier object.

Constructor & Destructor Documentation

◆ Classifier() [1/2]

Classifier ( Classifier  other)

Copy constructor for ShapeFinder classifiers

Parameters
otherclassifier to be duplicated
Exceptions
ArgumentNullExceptionIf other is null
ObjectDisposedExceptionIf other has already been disposed

◆ Classifier() [2/2]

Classifier ( string  fileName)

Load a saved classifier from a file.

Parameters
fileNamename of the file to be loaded
Exceptions
FileNotFoundExceptionIf the classifier file does not exist
FileLoadExceptionIf loading an existing classifier file failed either because the file is unreadable or because it does not contain a ShapeFinder2 classifier
ArgumentNullExceptionIf fileName is null

Member Function Documentation

◆ Append()

void Append ( Classifier  clf)

Append another classifier to this one. Appending means that the layers contained in clf will be appended to the layers of this classifier, so the layers (which may be considered models) of the two classifiers are left unchanged. Note that both classifiers involved must use the same gradient type.

Parameters
clfclassifier to be appended to this one
Exceptions
ArgumentNullExceptionIf clf is null
ObjectDisposedExceptionIf this classifir or clf have been disposed
InvalidOperationExceptionwhen trying to merge a classifier with a different gradient type

◆ DeleteFeatures()

void DeleteFeatures ( Rect  window)

Delete features in a given window from this classifier.

Parameters
windowrectangle in which to delete features (relative to the classifier's ClassifierObject.FeatureWindow)
Exceptions
ObjectDisposedExceptionIf this classifier has already been disposed

◆ ReverseContrasts()

void ReverseContrasts ( )

Reverse the contrasts on this ShapeFinder classifier.

Exceptions
ObjectDisposedExceptionIf this classifier has already been disposed

◆ SearchAll()

SearchResult[] SearchAll ( ImagePlane  plane,
Rect  aoi,
PrecisionMode  mode,
int  locality,
int  threshold 
)

Search for all matches inside an image plane .

Parameters
planeimage plane in which to search
aoiarea of interest in which to search
modeprecision to use
localityminimum distance between two results (if two results come closer than this distance (measured with the L1 norm) the one with the lower quality will be discarded)
thresholdminimum quality a result must have for being considered (quality corresponds to the number of model features found in the image)
Returns
list of the found results
Exceptions
ArgumentExceptionIf locality or threshold are less than 1

◆ SearchBest()

SearchResult SearchBest ( ImagePlane  plane,
Rect  aoi,
PrecisionMode  mode 
)

Search for the best pattern match in the plane

Parameters
planeimage plane to search in
aoiarea of interest to search in
modeprecision mode to use
Returns
the best matching result
Exceptions
ArgumentNullExceptionIf plane 's Parent is null
ArgumentOutOfRangeExceptionIf plane is less than 0 or greater or equal to the number of planes in the image
CvbExceptionIf the data type of the image plane to be processed is not 8 bits per pixel unsigned

◆ TruncateFeatures()

void TruncateFeatures ( int  count)

Shorten the list of classifier features based on each feature's quality.

Parameters
countdesired feature count after truncation; if count exceeds the value of FeatureCount then this function will not do anything
Exceptions
ObjectDisposedExceptionIf this classifier has already been disposed

Property Documentation

◆ AngularTolerance

Angle AngularTolerance
getset

Acceptance parameter for feature gradient angles. In ShapeFinder the angle of a feature is quantized into the range [0...255], i.e. in steps of roughly 1.41 degrees. When determining whether features extracted from an image match features stored in a classifier, the gradient's angle of the two features is compared not for strict equality, but for whether or not it falls into a certain range of differences. This acceptance window is defined by the Angular tolerance parameter. Valid values range from 0 (always match for identity only) to 16.

Exceptions
ObjectDisposedExceptionIf the classifier has already been disposed
ArgumentOutOfRangeExceptionwhen trying to set a value smaller than 0 or bigger than 16

◆ ContrastThreshold

int ContrastThreshold
getset

Threshold for the gradient slope.

Exceptions
ObjectDisposedExceptionIf the classifier has already been disposed
ArgumentOutOfRangeExceptionwhen trying to set a value smaller than 1

◆ FeatureCount

int FeatureCount
get

Number of features this classifier contains.

Exceptions
ObjectDisposedExceptionIf the classifier has already been disposed