Predictor that may be used for searching objects. More...
#include <cvb/polimago/search_predictor.hpp>
Inherits PredictorBase.
Public Member Functions | |
SearchPredictor (const String &fileName) | |
Load a saved Polimago search predictor from a file. More... | |
int | MaxNumResults () const noexcept |
Get the maximum number of results that can be extracted in a GridSearch operation. More... | |
void | SetMaxNumResults (int maxNumResults) |
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. More... | |
int | SampleSize () const noexcept |
Get the sample size that has been used in each training set. More... | |
double | ExtractionRadius () const noexcept |
Get the radius for extracting positive search instances. More... | |
ValueRange< Angle > | RotationRange () const noexcept |
Get the range of angles that was covered during classifier training. More... | |
ValueRange< double > | ScaleRange () const noexcept |
Get the range of scale factors that was covered during classifier training. More... | |
InvarianceType | Invariances () const noexcept |
Get the invariances that have been trained on this classifier. More... | |
int | NumClassificationSteps () const noexcept |
Get the number of classification steps defined during training. More... | |
int | FeatureResolutionStep1And2 () const noexcept |
Get the feature resolution to be used for the first two classification steps. More... | |
int | FeatureResolutionRest () const noexcept |
Get the feature resolution to be used for the third and later classification steps. More... | |
std::vector< SearchResult > | GridSearch (const Image &img, Rect< int > aoi, double gridStep, double threshold, double locality, int &numCalls) |
Perform a grid search. More... | |
std::vector< SearchResult > | GridSearch (const Image &img, Rect< int > aoi, double gridStep, double threshold, double locality) |
Perform a grid search. More... | |
bool | Inspect (const Image &img, SearchResult &res, int &searchDepth) |
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. More... | |
bool | Inspect (const Image &img, SearchResult &res, int &searchDepth, std::vector< SearchResult > &trace) |
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. More... | |
std::unique_ptr< Image > | SearchResultToImage (const Image &sourceImage, SearchResult res) |
Create a visual representation of a search result. More... | |
Public Member Functions inherited from PredictorBase | |
bool | IsCompatible (const Image &img, Point2D< int > pos) const |
Verify the compatibility of a CVB image with this classifier. More... | |
bool | IsCompatible (const Image &img) const |
Verify the compatibility of a CVB image with this classifier. More... | |
Public Member Functions inherited from PolimagoFactoryCreatedObject | |
void * | Handle () const noexcept |
Classic API Polimago handle. More... | |
String | FileName () const |
Name of the file the object has been loaded from (or empty string if the object was not loaded). More... | |
void | Save (const String &fileName) const |
Save this object into a file. More... | |
double | Lambda () const noexcept |
Regularization value that has been used for generating this object. More... | |
double | Offset () const noexcept |
Intercept weight that has been used for generating this object. More... | |
InterpolationType | Interpolation () const noexcept |
Interpolation setting used for generating this object. More... | |
int | ImagePlanes () const noexcept |
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. More... | |
Rect< int > | FeatureWindowExtent () const noexcept |
The feature window extent that has been used during classifier training. More... | |
Size2D< int > | RetinaSize () const noexcept |
Size of the 'Retina' in pixels. 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. More... | |
Point2D< double > | Correction () const noexcept |
Correction factors in X and Y direction required to rescale the input images for projection onto the retina. More... | |
String | Preprocessing () const |
Preprocessing code with which this object was generated. More... | |
Static Public Member Functions | |
static std::unique_ptr< SearchPredictor > | FromHandle (ReleaseObjectGuard &&guard) |
Creates predictor from a classic API handle. More... | |
static std::unique_ptr< SearchPredictor > | Load (const String &fileName) |
Load a saved predictor from a file. More... | |
Predictor that may be used for searching objects.
|
inlineexplicit |
Load a saved Polimago search predictor from a file.
[in] | fileName | Name of the file to be loaded. |
Any | exception derived from std::exception including CvbException. |
|
inlinenoexcept |
Get the radius for extracting positive search instances.
Does | not throw any exception. |
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.
|
inlinenoexcept |
Get the feature resolution to be used for the third and later classification steps.
Does | not throw any exception. |
|
inlinenoexcept |
Get the feature resolution to be used for the first two classification steps.
Does | not throw any exception. |
|
inlinestatic |
Creates predictor from a classic API handle.
[in] | guard | Life time guard for C-API handle. |
Any | exception derived from std::exception including CvbException. |
The predictor takes ownership of the handle, so you must share it before using this function.
|
inline |
Perform a grid search.
[in] | img | Image to search in. |
[in] | aoi | AOI inside the image to search in. |
[in] | gridStep | Spacing of the grid points in units of the feature window width/height. |
[in] | threshold | Minimum quality a result must have for being reported. |
[in] | locality | Minimum distance between the results that this SearchPredictor found. |
Any | exception derived from std::exception including CvbException. |
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.
|
inline |
Perform a grid search.
[in] | img | Image to search in. |
[in] | aoi | AOI inside the image to search in. |
[in] | gridStep | Spacing of the grid points in units of the feature window width/height. |
[in] | threshold | Minimum quality a result must have for being reported. |
[in] | locality | Minimum distance between the results that this SearchPredictor found. |
[out] | numCalls | Will receive the number of calls to the predictor's classification routine that have been carried out in the GridSearch call (output). |
Any | exception derived from std::exception including CvbException. |
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.
|
inline |
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.
[in] | img | Image to work on. |
[in,out] | res | Search Result to start with (upon exit: final result). |
[in,out] | searchDepth | Maximum number of steps to calculate (upon exit: number of steps actually calculated). |
Any | exception derived from std::exception including CvbException. |
When the function returns successfully, SearchResult will contain the final perspective and result quality. For additional information please see the tutorial on search functions of Polimago.
|
inline |
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.
[in] | img | Image to work on. |
[in,out] | res | Search Result to start with (upon exit: final result). |
[in,out] | searchDepth | Maximum number of steps to calculate (upon exit: number of steps actually calculated). |
[out] | trace | Search results that lead from the initial value of the res parameter to the final value. |
Any | exception derived from std::exception including CvbException. |
When the function returns successfully, SearchResult will contain the final perspective and result quality. For additional information please see the tutorial on search functions of Polimago.
|
inlinenoexcept |
Get the invariances that have been trained on this classifier.
Does | not throw any exception. |
|
inlinestatic |
Load a saved predictor from a file.
[in] | fileName | Name of the file to be loaded. |
Any | exception derived from std::exception including CvbException. |
|
inlinenoexcept |
Get the maximum number of results that can be extracted in a GridSearch operation.
Does | not throw any exception. |
|
inlinenoexcept |
Get the number of classification steps defined during training.
Does | not throw any exception. |
|
inlinenoexcept |
Get the range of angles that was covered during classifier training.
Does | not throw any exception. |
|
inlinenoexcept |
Get the sample size that has been used in each training set.
Does | not throw any exception. |
|
inlinenoexcept |
Get the range of scale factors that was covered during classifier training.
Does | not throw any exception. |
|
inline |
Create a visual representation of a search result.
[in] | sourceImage | Image to create the representation from. This should be the image on which the result was found with this classifier. |
[in] | res | Search result (should match the image and this classifier). |
Any | exception derived from std::exception including CvbException. |
|
inline |
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.
[in] | maxNumResults | The maximum number of results. |
Any | exception derived from std::exception including CvbException. |