CVB.Net 14.0
ClassifierFactory Class Reference

Object that holds methods for generating ShapeFinder classifiers. In case of ShapeFinder 1 the learner contains only static methods as no complex state aggregations are required here. More...

Static Public Member Functions

static int[] GradientHistogram (ImagePlane plane, Rect aoi, GradientType gradient)
 Calculate the gradient histogram over the aoi in an image plane . The gradient histogram may be useful to determine a suitable contrast threshold value for classifier generation and search operations. More...
 
static Classifier Learn (ImagePlane plane, Point2D position, Rect teachWindow, int contrastThreshold, GradientType gradientType)
 Create a ShapeFinder classifier from the input image plane . More...
 
static Classifier CreateCircle (double radius, int contrastThreshold, GradientType gradientType)
 Create a classifier that is able to detect a circle of a given radius . More...
 
static Classifier CreateLineSegment (Angle orientation, int length, int contrastThreshold, GradientType gradientType)
 Create a ShapeFinder classifier for the recognition of a straight line of specific length and orientation . More...
 
static Classifier CreateRotationInvariant (Classifier source, Angle startAngle, Angle stopAngle, int numLayers, int rotationsPerLayer)
 Generate a rotation symmetric classifier from the input classifier. Rotation symmetric in this context means that the resulting classifier will be able to identify the trained object in more than just the trained orientation (range that can be covered is controlled by the startAngle and stopAngle parameters). The angular sensitivity and the capability to report the found angle are controlled view the numLayers and the rotationsPerLayer parameter. For example it is possible to put all the rotations into just one layer (numLayers = 1, rotationsPerLayer = 255) so that the classifier will be able to correctly identify the object but not its orientation. The other extreme would be to have one rotation per layer, so that the layer information from the search function directly corresponds to orientation. Note that ShapeFinder (1) has very limited angular resolution - if you are interested in detecting orientation with a high degree of accuracy, consider using ShapeFinder2. Note that the product of numLayers and rotationsPerLayer should not become too high, otherwise the classifier will become fairly big and slow to process. More...
 

Static Public Attributes

const int ContrastThresholdMin = 1
 Minimum contrast for features eligible for entering the classifier.
 

Detailed Description

Object that holds methods for generating ShapeFinder classifiers. In case of ShapeFinder 1 the learner contains only static methods as no complex state aggregations are required here.

Member Function Documentation

◆ CreateCircle()

static Classifier CreateCircle ( double  radius,
int  contrastThreshold,
GradientType  gradientType 
)
static

Create a classifier that is able to detect a circle of a given radius .

Parameters
radiusradius of the circle classifier; must be bigger than 0
contrastThresholdminimum contrast of the circle features (must be greater than 0)
gradientTypetype of gradient extractor to use
Returns
newly created classifier

◆ CreateLineSegment()

static Classifier CreateLineSegment ( Angle  orientation,
int  length,
int  contrastThreshold,
GradientType  gradientType 
)
static

Create a ShapeFinder classifier for the recognition of a straight line of specific length and orientation .

Parameters
orientationangle of the line segment
lengthlength of the line segment in pixels (must be greater than 0)
contrastThresholdminimum contrast of the line segment features (must be greater than 0)
gradientType
Returns
A classifier representing the line segment defined by the input parameters.
Exceptions
ArgumentExceptionif length is less than or equal to zero or if contrastThreshold is less than or equal to zero.

◆ CreateRotationInvariant()

static Classifier CreateRotationInvariant ( Classifier  source,
Angle  startAngle,
Angle  stopAngle,
int  numLayers,
int  rotationsPerLayer 
)
static

Generate a rotation symmetric classifier from the input classifier. Rotation symmetric in this context means that the resulting classifier will be able to identify the trained object in more than just the trained orientation (range that can be covered is controlled by the startAngle and stopAngle parameters). The angular sensitivity and the capability to report the found angle are controlled view the numLayers and the rotationsPerLayer parameter. For example it is possible to put all the rotations into just one layer (numLayers = 1, rotationsPerLayer = 255) so that the classifier will be able to correctly identify the object but not its orientation. The other extreme would be to have one rotation per layer, so that the layer information from the search function directly corresponds to orientation. Note that ShapeFinder (1) has very limited angular resolution - if you are interested in detecting orientation with a high degree of accuracy, consider using ShapeFinder2. Note that the product of numLayers and rotationsPerLayer should not become too high, otherwise the classifier will become fairly big and slow to process.

Parameters
sourceclassifier to generate the rotation symmetric classifier from
numLayersnumber of layers to generate for the orientation; layers will be used for identifying the orientation of the object in the result feedback of the search functions
rotationsPerLayernumber of rotational states to be added per layer; decides over the angular resolution (which will never be better than roughly 1.4 degrees!)
startAnglerotation start angle in radians; must be within the range [-pi...pi] and less than or equal to stopAngle
stopAnglerotation stop angle in radians; must be within the range [-pi...pi] and greater or equal to startAngle
Returns
newly created rotation invariant classifier
Exceptions
ArgumentNullExceptionIf source is null
ArgumentOutOfRangeExceptionIf startAngle or stopAngle exceeds the range [-pi...pi] or if startAngle is greater than stopAngle or if numLayers or rotationsPerLayer are less than 1

◆ GradientHistogram()

static int[] GradientHistogram ( ImagePlane  plane,
Rect  aoi,
GradientType  gradient 
)
static

Calculate the gradient histogram over the aoi in an image plane . The gradient histogram may be useful to determine a suitable contrast threshold value for classifier generation and search operations.

Parameters
planeimage plane in which to claculate the histogram
aoiarea of interest in which to calculate the histogram
gradientgradient operator to use for the calculating the histogram
Returns
the calculated histogram
Exceptions
ArgumentNullExceptionIf the Parent of plane parameter is null
ObjectDisposedExceptionIf the Parent of plane has already been disposed
CvbExceptionwhen trying to learn a classifier from an image plane that does not have the data type 8 bits per pixel unsigned, or if an unspecific error occurs

◆ Learn()

static Classifier Learn ( ImagePlane  plane,
Point2D  position,
Rect  teachWindow,
int  contrastThreshold,
GradientType  gradientType 
)
static

Create a ShapeFinder classifier from the input image plane .

Parameters
planeimage plane to create the classifier from
positionposition in the input image at which to extract the classifier
teachWindowteach window for the classifier learning process relative to position
contrastThresholdminimum contrast a feature must have for entering the model
gradientTypegradient operator to use for calculating the model
Returns
the newly created classifier
Exceptions
ArgumentNullExceptionIf the Parent of the plane parameter is null
ObjectDisposedExceptionIf the Parent of plane has already been disposed
CvbExceptionwhen trying to learn a classifier from an image plane that does not have the data type 8 bits per pixel unsigned, or if an unspecific error occurs
ArgumentExceptionIf the position lies outside the image plane , the teachWindow lies outside the image plane or the contrastThreshold is less than 1