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 ());
54 : handle_(std::move(guard)),
55 trainingParameters_(),
71 return handle_.Handle();
92 SaveFunction (fileName);
103 return trainingParameters_.Lambda;
113 return trainingParameters_.Offset;
123 if (trainingParameters_.FeatureMap.Interpolate == 0)
140 return trainingParameters_.FeatureMap.NumImgPlanes;
150 return Rect<int> (trainingParameters_.FeatureMap.FWL, trainingParameters_.FeatureMap.FWT, trainingParameters_.FeatureMap.FWR, trainingParameters_.FeatureMap.FWB);
160 return Size2D<int> (trainingParameters_.FeatureMap.RetinaW, trainingParameters_.FeatureMap.RetinaH);
170 return Point2D<double> (trainingParameters_.FeatureMap.CorrectX, trainingParameters_.FeatureMap.CorrectY);
180 return Private::GetPreprocessing (trainingParameters_.FeatureMap);
184 virtual void SaveFunction (
const String &fileName)
const = 0;
187 CExports::TTrainParams& TrainingParameters() noexcept
189 return trainingParameters_;
192 const CExports::TTrainParams& TrainingParameters() const noexcept
194 return trainingParameters_;
197 mutable String fileName_;
200 ReleaseObjectGuard handle_;
201 CExports::TTrainParams trainingParameters_;
231 VerifyCompatibility (img, pos);
250 VerifyCompatibility (img);
260 void VerifyCompatibility (
const Image &img)
const
272 void VerifyCompatibility (
const Image &img, Point2D<int> pos)
const
274 VerifyCompatibility (img);
277 throw std::invalid_argument (
"The selected position cannot be evaluated because there is not enough image data available around it.");
281 throw std::invalid_argument (
"The selected position cannot be evaluated because there is not enough image data available around it.");
298 CVB_CALL_CAPI(PMGetClfTrainParams(
Handle(), TrainingParameters()));
310 return TrainingParameters().FeatureMap.FeatureResolution;
327 std::string asciiCode (Internal::CastToAscii(preproCode));
328 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:178
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:158
double Offset() const noexcept
Intercept weight that has been used for generating this object.
Definition: predictor_base.hpp:111
double Lambda() const noexcept
Regularization value that has been used for generating this object.
Definition: predictor_base.hpp:101
Rect< int > FeatureWindowExtent() const noexcept
The feature window extent that has been used during classifier training.
Definition: predictor_base.hpp:148
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:138
void Save(const String &fileName) const
Save this object into a file.
Definition: predictor_base.hpp:90
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:168
InterpolationType Interpolation() const noexcept
Interpolation setting used for generating this object.
Definition: predictor_base.hpp:121
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:79
void * Handle() const noexcept
Classic API Polimago handle.
Definition: predictor_base.hpp:69
Base class for Polimago predictors.
Definition: predictor_base.hpp:293
int FeatureResolution() const noexcept
Feature resolution value with which the classifier was trained.
Definition: predictor_base.hpp:308
Base class for Polimago predictors.
Definition: predictor_base.hpp:212
bool IsCompatible(const Image &img) const
Verify the compatibility of a CVB image with this classifier.
Definition: predictor_base.hpp:246
bool IsCompatible(const Image &img, Point2D< int > pos) const
Verify the compatibility of a CVB image with this classifier.
Definition: predictor_base.hpp:227
@ Private
Private name space.
int GetGranularity(const String &preproCode)
The function returns the granularity associated with a preprocessing code.
Definition: predictor_base.hpp:325
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:56