CVB.Net 14.0
SearchPredictor Class Reference

Predictor that may be used for searching objects. More...

Inherits PredictorBase.

Public Member Functions

override void Dispose ()
 Dispose search classifier.
 
 SearchPredictor (string fileName)
 Load a saved Polimago classification classifier from a file. More...
 
SearchResult[] GridSearch (Image img, Rect aoi, double gridStep, double threshold, double locality, out int numCalls)
 Perform a grid search. More...
 
SearchResult[] GridSearch (Image img, Rect aoi, double gridStep, double threshold, double locality)
 Perform a grid search. More...
 
SearchResult Inspect (Image img, Point2D pos, out int searchDepth)
 PMInspect carries out the operation that GridSearch executes for a grid point, starting at the position defined by pos and with an upright and untransformed perspective. More...
 
SearchResult Inspect (Image img, Point2D pos, out int searchDepth, out SearchResult[] trace)
 PMInspect carries out the operation that GridSearch executes for a grid point, starting at the position defined by pos and with an upright and untransformed perspective. More...
 
bool Inspect (Image img, ref SearchResult res, out int searchDepth)
 PMInspect carries out the operation that GridSearch executes for a grid point, starting at the perspective and position defined by the initial value of the parameter SearchResult. When PMInspect returns successfully, SearchResult will contain the final perspective and result quality. For additional information please see the tutorial on search functions of Polimago. More...
 
bool Inspect (Image img, ref SearchResult res, ref int searchDepth, out SearchResult[] trace)
 PMInspect carries out the operation that GridSearch executes for a grid point, starting at the perspective and position defined by the initial value of the parameter SearchResult. When PMInspect returns successfully, SearchResult will contain the final perspective and result quality. For additional information please see the tutorial on search functions of Polimago. More...
 
Image SearchResultToImage (Image sourceImage, SearchResult res)
 Create a visual representation of a search result. More...
 
- Public Member Functions inherited from PredictorBase
bool IsCompatible (Image img, Point2D pos)
 Verify the compatibility of a CVB image with this classifier. More...
 
bool IsCompatible (Image img)
 Verify the compatibility of a CVB image with this classifier. More...
 
- Public Member Functions inherited from PolimagoFactoryCreatedObject
void Save (string fileName)
 Save this object into a file. More...
 
virtual void Dispose ()
 IDisposable implementation. More...
 

Properties

int MaxNumResults [get, set]
 The maximum number of results that can be extracted in a GridSearch operation. Increasing this value will increase the amount of memory allocated by this SearchPredictor object.
 
int SampleSize [get]
 Sample size that has been used in each training set.
 
double ExtractionRadius [get]
 Radius for extracting positive search instances. The unit size is the size of the feature window, i.e. a value of 0.5 means that positive samples can be extracted from withing a range of +/- Feature Window Width and +/- Feature Window Height around each trained instance. Smaller values will necessitate a finer search grid but may yield better results on difficult search tasks.
 
ValueRange< AngleRotationRange [get]
 Range of angles that was covered during classifier training.
 
ValueRange< double > ScaleRange [get]
 Range of scale factors that was covered during classifier training.
 
InvarianceType Invariances [get]
 Invariances that have been trained on this classifier.
 
int NumClassificationSteps [get]
 Number of classification steps defined during training.
 
int FeatureResolutionStep1And2 [get]
 Feature resolution to be used for the first two classification steps.
 
int FeatureResolutionRest [get]
 Feature resolution to be used for the third and later classification steps.
 
- Properties inherited from PolimagoFactoryCreatedObject
string FileName [get, protected set]
 Name of the file the object has been loaded from (or More...
 
double Lambda [get]
 Regularization value that has been used for generating this object.
 
double Offset [get]
 Intercept weight that has been used for generating this object.
 
InterpolationType Interpolation [get]
 Interpolation setting used for generating this object.
 
int ImagePlanes [get]
 The plane count of the images that have been used for generating this classifier. Image on which this classifier is to be used will need to have the same plane count.
 
Rect FeatureWindowExtent [get]
 The feature window extent that has been used during classifier training.
 
Size2D RetinaSize [get]
 Size of the "Retina" in paxels. The retina is the set of paxels onto which the input image is projected using the preprocessing code prior to application/training of the classifier.
 
Point2Dd Correction [get]
 Correction factors in X and Y direction required to rescale the input images for projection onto the retina.
 
string Preprocessing [get]
 Preprocessing code with which this object was generated.
 
- Properties inherited from PolimagoRefCountedObject
IntPtr Handle [get]
 Native Manto classifier handle. More...
 
bool IsDisposed [get]
 Tests if the native handle has already been disposed.
 
- 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

- Static Public Member Functions inherited from PredictorBase
static int GetGranularity (string preproCode)
 The function returns the granularity (see tutorial) associated with a preprocessing code. More...
 
- Protected Member Functions inherited from PredictorBase
void VerifyCompatibility (Image img)
 Verify the compatibility of a CVB image with this classifier. More...
 
void VerifyCompatibility (Image img, Point2D pos)
 Verify the compatibility of a CVB image with this classifier. More...
 
- Protected Member Functions inherited from PolimagoRefCountedObject
virtual void Dispose (bool disposing)
 IDispose helper function. More...
 
- Events inherited from PolimagoRefCountedObject
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

Predictor that may be used for searching objects.

Constructor & Destructor Documentation

◆ SearchPredictor()

SearchPredictor ( string  fileName)

Load a saved Polimago classification 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
ArgumentNullExceptionIf fileName is null

Member Function Documentation

◆ GridSearch() [1/2]

SearchResult[] GridSearch ( Image  img,
Rect  aoi,
double  gridStep,
double  threshold,
double  locality 
)

Perform a grid search.

Parameters
imgImage to search in.
aoiAOI inside the image to search in.
gridStepSpacing of the grid points in units of the feature window width/height.
thresholdMinimum quality a result must have for being reported.
localityMinimum distance between the results that this SearchPredictor found. If two results that exceed the quality requirement defined by the threshold parameter are spaced less than locality pixels apart (in either x or y direction) then the result with the lower quality will be eliminated from the result list.
Returns
List of results that this SearchPredictor found in the area of interest.

◆ GridSearch() [2/2]

SearchResult[] GridSearch ( Image  img,
Rect  aoi,
double  gridStep,
double  threshold,
double  locality,
out int  numCalls 
)

Perform a grid search.

Parameters
imgImage to search in.
aoiAOI inside the image to search in.
gridStepSpacing of the grid points in units of the feature window width/height.
thresholdMinimum quality a result must have for being reported.
localityMinimum distance between the results that this SearchPredictor found. If two results that exceed the quality requirement defined by the threshold parameter are spaced less than locality pixels apart (in either x or y direction) then the result with the lower quality will be eliminated from the result list.
numCallsWill receive the number of calls to the predictor's classification routine that have been carried out in the GridSearch(Image, Rect, double, double, double, out int) call.
Returns
List of results that this SearchPredictor found in the area of interest.

◆ Inspect() [1/4]

SearchResult Inspect ( Image  img,
Point2D  pos,
out int  searchDepth 
)

PMInspect carries out the operation that GridSearch executes for a grid point, starting at the position defined by pos and with an upright and untransformed perspective.

Parameters
imgImage to work on.
posPosition at which to start.
searchDepthreceives the number of steps that were executed.
Returns

◆ Inspect() [2/4]

SearchResult Inspect ( Image  img,
Point2D  pos,
out int  searchDepth,
out SearchResult[]  trace 
)

PMInspect carries out the operation that GridSearch executes for a grid point, starting at the position defined by pos and with an upright and untransformed perspective.

Parameters
imgImage to work on.
posPosition at which to start.
searchDepthreceives the number of steps that were executed.
traceInspection trace (series of intermediate results).
Returns
SearchResult (SearchResult.None if nothing was found)

◆ Inspect() [3/4]

bool Inspect ( Image  img,
ref SearchResult  res,
out int  searchDepth 
)

PMInspect carries out the operation that GridSearch executes for a grid point, starting at the perspective and position defined by the initial value of the parameter SearchResult. When PMInspect returns successfully, SearchResult will contain the final perspective and result quality. For additional information please see the tutorial on search functions of Polimago.

Parameters
imgImage to work on.
resSearch Result to start with (upon exit: final result)
searchDepthMaximum number of steps to calculate (upon exit: number of steps actually calculated).
Returns
true if the SearchPredictor found a result when starting at the position defined through the res parameter, false otherwise.

◆ Inspect() [4/4]

bool Inspect ( Image  img,
ref SearchResult  res,
ref int  searchDepth,
out SearchResult[]  trace 
)

PMInspect carries out the operation that GridSearch executes for a grid point, starting at the perspective and position defined by the initial value of the parameter SearchResult. When PMInspect returns successfully, SearchResult will contain the final perspective and result quality. For additional information please see the tutorial on search functions of Polimago.

Parameters
imgImage to work on.
resSearch Result to start with (upon exit: final result)
searchDepthMaximum number of steps to calculate (upon exit: number of steps actually calculated).
traceSearch results that lead from the initial value of the res parameter to the final value.
Returns
true if the SearchPredictor found a result when starting at the position defined through the res parameter, false otherwise.

◆ SearchResultToImage()

Image SearchResultToImage ( Image  sourceImage,
SearchResult  res 
)

Create a visual representation of a search result.

Parameters
sourceImageImage to create the representation from. This should be the image on which the result was found with this classifier.
resSearch result (should match the image and this classifier).
Returns
Visual representation of the search result.