3#include "../_cexports/c_polimago.h"
5#include "../global.hpp"
7#include "../string.hpp"
9#include "../size_2d.hpp"
10#include "../point_2d.hpp"
24inline String GetPreprocessing (CExports::TFeatureMap fm)
27 return String (s.begin (), s.end ());
47 : handle_(std::move(guard)),
48 trainingParameters_(),
68 return handle_.Handle();
89 SaveFunction (fileName);
100 return trainingParameters_.Lambda;
110 return trainingParameters_.Offset;
120 if (trainingParameters_.FeatureMap.Interpolate == 0)
137 return trainingParameters_.FeatureMap.NumImgPlanes;
147 return Rect<int> (trainingParameters_.FeatureMap.FWL, trainingParameters_.FeatureMap.FWT, trainingParameters_.FeatureMap.FWR, trainingParameters_.FeatureMap.FWB);
157 return Size2D<int> (trainingParameters_.FeatureMap.RetinaW, trainingParameters_.FeatureMap.RetinaH);
167 return Point2D<double> (trainingParameters_.FeatureMap.CorrectX, trainingParameters_.FeatureMap.CorrectY);
177 return Private::GetPreprocessing (trainingParameters_.FeatureMap);
181 virtual void SaveFunction (
const String &fileName)
const = 0;
185 ReleaseObjectGuard handle_;
187 CExports::TTrainParams trainingParameters_;
222 VerifyCompatibility (img, pos);
241 VerifyCompatibility (img);
251 void VerifyCompatibility (
const Image &img)
const
263 void VerifyCompatibility (
const Image &img, Point2D<int> pos)
const
265 VerifyCompatibility (img);
268 throw std::invalid_argument (
"The selected position cannot be evaluated because there is not enough image data available around it.");
272 throw std::invalid_argument (
"The selected position cannot be evaluated because there is not enough image data available around it.");
289 CVB_CALL_CAPI(PMGetClfTrainParams(
Handle(), trainingParameters_));
306 return trainingParameters_.FeatureMap.FeatureResolution;
323 std::string asciiCode (Internal::CastToAscii(preproCode));
324 return CVB_CALL_CAPI(PMGetGranularity(asciiCode.c_str()));
The Common Vision Blox image.
Definition: decl_image.hpp:45
Base class for Polimago objects created by one of the factory classes.
Definition: predictor_base.hpp:44
String Preprocessing() const
Preprocessing code with which this object was generated.
Definition: predictor_base.hpp:175
Size2D< int > RetinaSize() const noexcept
Size of the 'Retina' in pixels. The retina is the set of paxels onto which the input image is project...
Definition: predictor_base.hpp:155
double Offset() const noexcept
Intercept weight that has been used for generating this object.
Definition: predictor_base.hpp:108
double Lambda() const noexcept
Regularization value that has been used for generating this object.
Definition: predictor_base.hpp:98
Rect< int > FeatureWindowExtent() const noexcept
The feature window extent that has been used during classifier training.
Definition: predictor_base.hpp:145
int ImagePlanes() const noexcept
The plane count of the images that have been used for generating this classifier. Image on which this...
Definition: predictor_base.hpp:135
void Save(const String &fileName) const
Save this object into a file.
Definition: predictor_base.hpp:87
Point2D< double > Correction() const noexcept
Correction factors in X and Y direction required to rescale the input images for projection onto the ...
Definition: predictor_base.hpp:165
InterpolationType Interpolation() const noexcept
Interpolation setting used for generating this object.
Definition: predictor_base.hpp:118
String FileName() const
Name of the file the object has been loaded from (or empty string if the object was not loaded).
Definition: predictor_base.hpp:76
void * Handle() const noexcept
Classic API Polimago handle.
Definition: predictor_base.hpp:66
Base class for Polimago predictors.
Definition: predictor_base.hpp:284
int FeatureResolution() const noexcept
Feature resolution value with which the classifier was trained.
Definition: predictor_base.hpp:304
Base class for Polimago predictors.
Definition: predictor_base.hpp:198
bool IsCompatible(const Image &img) const
Verify the compatibility of a CVB image with this classifier.
Definition: predictor_base.hpp:237
bool IsCompatible(const Image &img, Point2D< int > pos) const
Verify the compatibility of a CVB image with this classifier.
Definition: predictor_base.hpp:218
@ Private
Private name space.
int GetGranularity(const String &preproCode)
The function returns the granularity associated with a preprocessing code.
Definition: predictor_base.hpp:321
InterpolationType
Interpolation to be used when extracting image data for classifier generation.
Definition: predictor_base.hpp:33
@ Linear
Image data is (if necessary) extracted with linear interpolation.
@ None
Image data is (if necessary) extracted without interpolation.
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
std::string String
String for wide characters or unicode characters.
Definition: string.hpp:45