3#include "../_cexports/c_minos.h"
5#include "../global.hpp"
7#include "../matrix_2d.hpp"
8#include "../point_2d.hpp"
10#include "../area_2d.hpp"
12#include "search_result.hpp"
23namespace Minos {
class TrainingSet; }
26inline HandleGuard<Minos::TrainingSet>::HandleGuard(
void * handle) noexcept
27 : HandleGuard<Minos::TrainingSet>(handle, [](
void* h) { CVB_CALL_CAPI(ReleaseObject(h)); })
54 InstanceInfo (
const SharedHandleGuard<TrainingSet> &sguardTrSet, CExports::MTSINSTANCE nativeHandle, PrivateTag)
55 : sguardTrSet_(sguardTrSet), nativeHandle_ (nativeHandle)
67 return static_cast<int> (CVB_CALL_CAPI (InstanceIndex(
Handle())));
78 return Internal::DoHandleCallObjectOut<class Image>(CVB_CALL_CAPI(CreateImageFromInstance(
Handle())));
88 double GetCorrelation ()
const
109 double dX = CVB_CALL_CAPI (InstanceX(
Handle()));
110 double dY = CVB_CALL_CAPI (InstanceY(
Handle()));
131 return nativeHandle_;
135 SharedHandleGuard<TrainingSet> sguardTrSet_;
136 CExports::MTSINSTANCE nativeHandle_;
149 return (lhs.Handle() == rhs.Handle());
162 return (!(lhs == rhs));
168 auto ReadInfos (
const T &collection) ->
std::vector<
decltype(collection.ReadInfo(0))>
170 auto count = collection.Count ();
171 std::vector<
decltype(collection.ReadInfo (0))> info;
172 for (
decltype(count) i = 0; i < count; ++i)
174 info.push_back (collection.ReadInfo (i));
180 template<
class Tcol,
class Tobj>
int IndexOf (
const Tcol &collection,
const Tobj &obj)
182 auto count = collection.Count ();
183 for (
decltype(count) i = 0; i <
count; ++i)
185 auto readInfo = collection.ReadInfo(i);
186 if (*readInfo == obj)
231 auto instHandle = GetInstanceNativeHandle (index);
232 if (instHandle ==
nullptr)
234 Utilities::SystemInfo::ThrowLastError ();
236 return std::make_unique<InstanceInfo>(shandle_, instHandle, InstanceInfo::PrivateTag{});
247 return Private::ReadInfos (*
this);
260 return Private::IndexOf (*
this, obj);
276 auto count =
Count ();
277 for (
decltype(count) i = 0; i < count; ++i)
281 CVB_CALL_CAPI_CHECKED (RemoveMTSInstance(instance.
Handle()));
305 virtual int GetCount ()
const = 0;
306 virtual CExports::MTSINSTANCE GetInstanceNativeHandle (
int index)
const = 0;
309 SharedHandleGuard<TrainingSet> shandle_;
320 collectionParent_(sguard.Handle())
325 int GetCount ()
const override
327 return static_cast<int> (CVB_CALL_CAPI (NumMTSInstances(collectionParent_)));
330 CExports::MTSINSTANCE GetInstanceNativeHandle (
int index)
const override
332 return CVB_CALL_CAPI (MTSInstance (collectionParent_, index));
336 CExports::MTSINSTANCE collectionParent_;
347 collectionParent_(collectionParent)
364 double dX = location.
X();
365 double dY = location.
Y();
366 CExports::MTSINSTANCE instance =
nullptr;
367 CVB_CALL_CAPI_CHECKED (NewMTSInstanceTyped(collectionParent_, name.c_str(), askForce, dX, dY, instance));
368 if (instance ==
nullptr)
372 return std::make_unique<InstanceInfo>(shandle_, instance, InstanceInfo::PrivateTag{});
376 int GetCount ()
const override
378 return static_cast<int> (CVB_CALL_CAPI (NumMTSImageInstances(collectionParent_)));
381 CExports::MTSINSTANCE GetInstanceNativeHandle (
int index)
const override
383 return CVB_CALL_CAPI (MTSImageInstance (collectionParent_, index));
387 CExports::MTSIMAGE collectionParent_;
398 collectionParent_(collectionParent)
402 int GetCount ()
const override
404 return static_cast<int> (CVB_CALL_CAPI (NumMTSModelInstances(collectionParent_)));
407 CExports::MTSINSTANCE GetInstanceNativeHandle (
int index)
const override
409 return CVB_CALL_CAPI (MTSModelInstance (collectionParent_, index));
413 CExports::MTSMODEL collectionParent_;
424 struct PrivateTag {};
433 ImageInfo (
const SharedHandleGuard<TrainingSet> &sguardTrSet,
int index, PrivateTag)
434 : sguardTrSet_(sguardTrSet),
435 nativeHandle_ (CVB_CALL_CAPI (MTSImage(sguardTrSet.Handle(), index))),
436 instances_ (sguardTrSet_, nativeHandle_)
438 if (nativeHandle_ ==
nullptr)
440 Utilities::SystemInfo::ThrowLastError();
454 return static_cast<int> (CVB_CALL_CAPI (MTSImageIndex(
Handle())));
465 return Internal::DoBoolCallObjectOut<class Image>([&](
void* & resimg)
467 resimg = CVB_CALL_CAPI(GetImageFromImage(
Handle()));
468 return CVB_CALL_CAPI(ShareObject (resimg));
482 CVB_CALL_CAPI_CHECKED(TransformMTSImage(
Handle(),
reinterpret_cast<const CExports::TMatrix&
>(matrix)));
495 CExports::RESULTS hSearchResults =
nullptr;
496 CVB_CALL_CAPI_CHECKED (MTSImageCheck (
Handle(), threshold,
static_cast<int>(density * 1000.0),
nullptr,
nullptr, hSearchResults));
497 ReleaseObjectGuard hSearchResHolder (hSearchResults);
498 return Private::SearchResultsToArray(hSearchResults);
523 return nativeHandle_;
527 SharedHandleGuard<TrainingSet> sguardTrSet_;
528 CExports::MTSIMAGE nativeHandle_;
542 return (lhs.Handle() == rhs.Handle());
555 return (!(lhs == rhs));
560 auto imageIndex = CVB_CALL_CAPI(GetImageFromInstance(
Handle()));
561 return std::make_unique<ImageInfo>(sguardTrSet_, CVB_CALL_CAPI(MTSImageIndex(imageIndex)), ImageInfo::PrivateTag{});
588 return static_cast<int> (CVB_CALL_CAPI (NumMTSImages(shandle_.Handle())));
600 return std::make_unique<ImageInfo>(shandle_, index, ImageInfo::PrivateTag{});
611 return Private::ReadInfos (*
this);
624 return Private::IndexOf (*
this, obj);
638 auto h = CVB_CALL_CAPI (NewMTSImageIndex(shandle_.Handle(), plane.
Parent().
Handle(), plane.
Plane()));
641 Utilities::SystemInfo::ThrowLastError ();
658 auto count =
Count ();
659 for (
decltype(count) i = 0; i < count; ++i)
663 CVB_CALL_CAPI_CHECKED (RemoveMTSImage(image.
Handle()));
687 SharedHandleGuard<TrainingSet> shandle_;
697 struct PrivateTag {};
706 ModelInfo (
const SharedHandleGuard<TrainingSet> &sguardTrSet,
int index, PrivateTag)
707 : sguardTrSet_(sguardTrSet),
708 nativeHandle_ (CVB_CALL_CAPI (MTSModel(sguardTrSet.Handle(), index))),
709 instances_ (sguardTrSet_, nativeHandle_)
711 if (nativeHandle_ ==
nullptr)
713 Utilities::SystemInfo::ThrowLastError ();
727 return static_cast<int> (CVB_CALL_CAPI (MTSModelIndex(
Handle())));
738 return Internal::DoBoolCallObjectOut<class Image>([&](
void* & resimg)
740 resimg = CVB_CALL_CAPI(GetImageFromModel(
Handle()));
741 return CVB_CALL_CAPI(ShareObject (resimg));
752 const Char *name =
nullptr;
753 CVB_CALL_CAPI (GetModelNameTyped(
Handle(), name));
769 CVB_CALL_CAPI_CHECKED (SetModelNameTyped(
Handle(), name.c_str()));
780 CVB_CALL_CAPI_CHECKED (GetModelAdvance (
Handle(), advX, advY));
791 CVB_CALL_CAPI_CHECKED (SetModelAdvance (
Handle(), advanceVector.
X(), advanceVector.
Y()));
802 Area2D featureWindowNative;
803 CVB_CALL_CAPI_CHECKED (GetFeatureWindow (
Handle(),
reinterpret_cast<CExports::TArea&
>(featureWindowNative)));
804 return Round (
Rect<double> (featureWindowNative.
P0().
X(), featureWindowNative.
P0().
Y(), featureWindowNative.
P1().
X(), featureWindowNative.
P2().
Y()));
816 CVB_CALL_CAPI_CHECKED (
SetFeatureWindow (
Handle(),
reinterpret_cast<CExports::TArea&
>(featureWindowNative)));
826 return Image()->CoordinateSystem().Translation();
836 auto cs =
Image()->CoordinateSystem();
837 cs.Translation() = origin;
838 Image()->CoordinateSystem() = cs;
839 CVB_CALL_CAPI_CHECKED (TranslateModelOrigin(
Handle()));
866 CExports::RESULTS hSearchResults =
nullptr;
867 CVB_CALL_CAPI_CHECKED (MTSModelImageCheck (
Handle(), trainingSetImage.
Handle(), threshold,
static_cast<int>(density * 1000.0),
nullptr,
nullptr, hSearchResults));
868 ReleaseObjectGuard hSearchResHolder (hSearchResults);
869 return Private::SearchResultsToArray(hSearchResults);
882 CExports::RESULTS hSearchResults =
nullptr;
883 CVB_CALL_CAPI_CHECKED (MTSModelCheck (
Handle(), threshold,
static_cast<int>(density * 1000.0),
nullptr,
nullptr, hSearchResults));
884 ReleaseObjectGuard hSearchResHolder (hSearchResults);
885 return Private::SearchResultsToArray(hSearchResults);
900 int left = INT_MAX, top = INT_MAX, right = INT_MAX, bottom = INT_MAX;
904 auto loc_x =
static_cast<int>(std::lround(i->Location ().X ()));
909 auto loc_y =
static_cast<int>(std::lround(i->Location ().Y ()));
914 auto srcimg_w = i->SourceImage ()->Image ()->Width ();
915 if (srcimg_w - loc_x < right)
917 right = srcimg_w - loc_x - 1;
919 auto srcimg_h = i->SourceImage ()->Image ()->Height ();
920 if (srcimg_h - loc_y < bottom)
922 bottom = srcimg_h - loc_y - 1;
928 return Rect<int>(left, top, right, bottom);
943 return Rect<int>(left, top, right, bottom);
955 return nativeHandle_;
959 SharedHandleGuard<TrainingSet> sguardTrSet_;
960 CExports::MTSMODEL nativeHandle_;
974 return (lhs.Handle() == rhs.Handle());
987 return (!(lhs == rhs));
992 auto modelIndex = CVB_CALL_CAPI(GetModelFromInstance(nativeHandle_));
993 return std::make_unique<ModelInfo>(sguardTrSet_, CVB_CALL_CAPI(MTSModelIndex(modelIndex)), ModelInfo::PrivateTag{});
1020 return static_cast<int> (CVB_CALL_CAPI (NumMTSModels(shandle_.Handle())));
1032 return std::make_unique<ModelInfo>(shandle_, index, ModelInfo::PrivateTag{});
1043 return Private::ReadInfos (*
this);
1056 return Private::IndexOf (*
this, obj);
1068 auto count =
Count ();
1069 for (
decltype(count) i = 0; i < count; ++i)
1092 auto instance = CVB_CALL_CAPI (NewMTSModelTyped(image.
Handle(), name.c_str(), location.
X(), location.
Y(),
reinterpret_cast<CExports::TArea&
>(featureWindowNative)));
1093 if (instance ==
nullptr)
1095 Utilities::SystemInfo::ThrowLastError ();
1112 auto count =
Count ();
1113 for (
decltype(count) i = 0; i < count; ++i)
1117 CVB_CALL_CAPI_CHECKED (RemoveMTSModel(model.
Handle()));
1148 CVB_CALL_CAPI_CHECKED(SetMTSGlobalAdvance(shandle_.Handle(),
true, vec.
X(), vec.
Y()));
1152 SharedHandleGuard<TrainingSet> shandle_;
1164 : shandle_(std::move(guard)),
1165 fileName_ (srcFileName),
1166 instances_ (shandle_), images_ (shandle_), models_ (shandle_)
1171 static CExports::MTS CreateInternal ()
1173 CExports::MTS mts = CVB_CALL_CAPI (CreateMTS(3, 0.6));
1176 Utilities::SystemInfo::ThrowLastError();
1182 static CExports::MTS LoadInternal (
const String & fileName)
1184 CExports::MTS mts =
nullptr;
1186 CVB_CALL_CAPI_CHECKED (LoadMTSFileTyped (fileName.c_str(), mts));
1226 return std::make_unique<TrainingSet>(fileName);
1238 return Internal::DoBoolCallObjectOut<TrainingSet>([&](
void* & restset)
1241 return CVB_CALL_CAPI(MemoryToMTS (
const_cast<void*
>(buffer),
static_cast<long>(size), restset));
1251 template <
class RANGE>
1254 auto bufferRange = MakeRangeAdapter<std::uint8_t> (buffer);
1255 return FromBuffer (bufferRange.Data (), bufferRange.Size ());
1267 return shandle_.Handle();
1280 if (!guard.Handle ())
1296 CVB_CALL_CAPI_CHECKED (WriteMTSFileTyped (
Handle(), fileName.c_str()));
1297 fileName_ = fileName;
1308 auto sizeNeeded = CVB_CALL_CAPI (GetMTSSize(
Handle()));
1310 CVB_CALL_CAPI_CHECKED (MTSToMemory (
Handle(), buffer.data(), sizeNeeded));
1323 return Internal::DoBoolCallObjectOut<TrainingSet>([&](
void* & resclas)
1326 return CVB_CALL_CAPI(MTSTransform (
Handle(),
reinterpret_cast<const CExports::TMatrix&
>(transformation), resclas));
1340 CExports::RESULTS hSearchResults =
nullptr;
1341 CVB_CALL_CAPI_CHECKED (MTSConsistencyCheck (
Handle (), threshold,
static_cast<int>(density * 1000.0),
nullptr,
nullptr, hSearchResults));
1342 ReleaseObjectGuard hSearchResHolder (hSearchResults);
1343 return Private::SearchResultsToArray(hSearchResults);
1356 return static_cast<int> (CVB_CALL_CAPI (NumMTSClasses(
Handle())));
1379 return instances_.
Count();
1427 CExports::cvbbool_t retval =
false;
1428 CVB_CALL_CAPI_CHECKED (GetMTSModified(
Handle(), retval));
1441 CVB_CALL_CAPI_CHECKED (SetMTSModified(
Handle(), isModified));
1451 CExports::cvbdim_t left = 0, top = 0, right = 0, bottom = 0;
1452 CVB_CALL_CAPI_CHECKED (GetMTSExtent (
Handle (), left, top, right, bottom));
1453 return Rect<int> (
static_cast<int>(left),
static_cast<int>(top),
static_cast<int>(right),
static_cast<int>(bottom));
1465 CVB_CALL_CAPI_CHECKED (GetMTSLastFeatureWnd(
Handle(),
reinterpret_cast<CExports::TArea&
>(area)));
1476 const Char *comment =
nullptr;
1477 CVB_CALL_CAPI (MTSCommentTyped(
Handle(), comment));
1478 return (comment !=
nullptr) ?
String (comment) :
String ();
1488 CVB_CALL_CAPI_CHECKED (SetMTSCommentTyped (
Handle(), comment.c_str()));
1499 CVB_CALL_CAPI_CHECKED (GetMTSCorelParams(
Handle(), expectationRadius, correlationThreshold));
1500 return expectationRadius;
1521 CVB_CALL_CAPI_CHECKED (GetMTSCorelParams(
Handle(), expectationRadius, correlationThreshold));
1522 return correlationThreshold;
1536 SharedHandleGuard<TrainingSet> shandle_;
1537 mutable String fileName_;
Structure that represents an area of interest in the image.
Definition: area_2d.hpp:21
Point2D< double > P2() const noexcept
Gets P2 of the area (top right corner).
Definition: area_2d.hpp:117
Point2D< double > P0() const noexcept
Gets P0 of the area (top left corner).
Definition: area_2d.hpp:89
Point2D< double > P1() const noexcept
Gets P1 of the area (lower left corner).
Definition: area_2d.hpp:103
void * Handle() const noexcept
Classic API image handle.
Definition: decl_image.hpp:226
Image plane information container.
Definition: decl_image_plane.hpp:33
int Plane() const noexcept
Plane index in the image, to which this plane refers to.
Definition: decl_image_plane.hpp:167
const Image & Parent() const noexcept
Image to which this plane descriptor refers to.
Definition: detail_image_plane.hpp:87
Double precision 2x2 matrix class.
Definition: matrix_2d.hpp:16
Class that maintains the collection of Training Images inside a Minos Training Set.
Definition: training_set.hpp:568
void Add(const ImagePlane &plane)
Add a new training set image to the parent training set.
Definition: training_set.hpp:636
std::vector< std::unique_ptr< ImageInfo > > ReadInfos() const
Retrieves all the items stored in the collection.
Definition: training_set.hpp:609
int Count() const
Retrieves the number of elements in the collection.
Definition: training_set.hpp:586
int IndexOf(const ImageInfo &obj) const
Determine the index of an image information object inside this collection.
Definition: training_set.hpp:622
bool Remove(const ImageInfo &image)
Remove a training set image along with its instances from the training set.
Definition: training_set.hpp:656
std::unique_ptr< ImageInfo > ReadInfo(int index) const
Retrieves the indexed image information block.
Definition: training_set.hpp:598
bool RemoveAt(int index)
Remove a training set image along with its instances from the training set.
Definition: training_set.hpp:681
Image that has been added to a training set.
Definition: training_set.hpp:420
std::vector< SearchResult > CheckConsistency(double threshold, double density=1.0)
Test this image for potentially forgotten instances to be trained.
Definition: training_set.hpp:493
void TransformImageAndInstances(Matrix2D matrix)
Transform this image and all instances trained from this image using a 2x2 matrix.
Definition: training_set.hpp:479
std::unique_ptr< class Image > Image() const
Image representation of this object.
Definition: training_set.hpp:463
int Index() const
Index of this object in the parent's collection.
Definition: training_set.hpp:452
ImageInstanceInfoCollection & Instances()
The instances belonging to this model.
Definition: training_set.hpp:509
void * Handle() const noexcept
Classic API MTSIMAGE handle.
Definition: training_set.hpp:521
Class that maintains the collection of Training Images inside a Minos Training Set.
Definition: training_set.hpp:343
std::unique_ptr< InstanceInfo > Add(const String &name, bool askForce, Point2D< double > location)
Extract a new instance from the parent image and added it to the model with the specified name.
Definition: training_set.hpp:362
Class that maintains the collection of Training Images inside a Minos object.
Definition: training_set.hpp:199
std::unique_ptr< InstanceInfo > ReadInfo(int index) const
Retrieves the indexed instance information block.
Definition: training_set.hpp:229
int Count() const
Retrieves the number of elements in the collection.
Definition: training_set.hpp:217
std::vector< std::unique_ptr< InstanceInfo > > ReadInfos() const
Retrieves all the items stored in the collection.
Definition: training_set.hpp:245
bool Remove(const InstanceInfo &instance)
Remove an instance from the training set.
Definition: training_set.hpp:274
int IndexOf(const InstanceInfo &obj) const
Determine the index of an image information object inside this collection.
Definition: training_set.hpp:258
bool RemoveAt(int index)
Remove an instance from the training set.
Definition: training_set.hpp:299
Class that maintains the collection of Training Images inside a Minos Training Set.
Definition: training_set.hpp:316
Instance information that has been added to a training set.
Definition: training_set.hpp:43
std::unique_ptr< ModelInfo > Model() const
The Training Set Model into which this instance has been trained.
Definition: training_set.hpp:990
std::unique_ptr< class Image > Image() const
Image representation of this object.
Definition: training_set.hpp:76
int Index() const
Index of this object in the parent's collection.
Definition: training_set.hpp:65
Point2D< double > Location() const
Position in the SourceImage from which this instance has been extracted.
Definition: training_set.hpp:107
std::unique_ptr< ImageInfo > SourceImage() const
Retrieve the correlation between this instance image and the model image.
Definition: training_set.hpp:558
void * Handle() const noexcept
Classic API MTSINSTANCE handle.
Definition: training_set.hpp:129
Class that maintains the collection of Training Images inside a Minos Training Set.
Definition: training_set.hpp:1000
bool Remove(const ModelInfo &model)
Remove a model (and all the instances extracted for that model!) from the training set.
Definition: training_set.hpp:1110
std::vector< std::unique_ptr< ModelInfo > > ReadInfos() const
Retrieves all the items stored in the collection.
Definition: training_set.hpp:1041
std::unique_ptr< ModelInfo > ReadInfo(int index) const
Retrieves the indexed model information block.
Definition: training_set.hpp:1030
int Count() const
Retrieves the number of elements in the collection.
Definition: training_set.hpp:1018
bool Contains(const String &name)
Check if the collection contains a model with the specified name.
Definition: training_set.hpp:1066
int IndexOf(const ModelInfo &obj) const
Determine the index of an image information object inside this collection.
Definition: training_set.hpp:1054
void SetGlobalAdvanceVector(Point2D< double > vec)
Set an advance vector for all available models.
Definition: training_set.hpp:1146
void Add(const ImageInfo &image, const String &name, Point2D< double > location, Rect< int > featureWindow)
Add a new model (plus the first instance of that model) to the training set.
Definition: training_set.hpp:1088
bool RemoveAt(int index)
Remove a model (and all the instances extracted for that model!) from the training set.
Definition: training_set.hpp:1135
Model that has been added to a training set.
Definition: training_set.hpp:694
const ModelInstanceInfoCollection & Instances() const
The instances belonging to this model.
Definition: training_set.hpp:850
std::vector< SearchResult > CheckConsistency(double threshold, double density=1.0)
Test all images in the parent training set for instances of this model that might have been forgotten...
Definition: training_set.hpp:880
Rect< int > GetExtractableArea(const ImageInfo &image) const
Determine the maximum area from which an instance of this model may be extracted from a given trainin...
Definition: training_set.hpp:937
Point2D< double > AdvanceVector() const
Get the advance vector associated with this model.
Definition: training_set.hpp:777
Point2D< double > Origin() const
Get the origin of the model in terms of coordinates inside the feature window.
Definition: training_set.hpp:824
std::vector< SearchResult > CheckConsistency(const ImageInfo &trainingSetImage, double threshold, double density=1.0)
Test the image referenced by trainingSetImage for instances of this model that might have been forgot...
Definition: training_set.hpp:864
void SetAdvanceVector(Point2D< double > advanceVector)
Set the advance vector associated with this model.
Definition: training_set.hpp:789
std::unique_ptr< class Image > Image() const
Image representation of this object.
Definition: training_set.hpp:736
String Name() const
Get the name of the model.
Definition: training_set.hpp:750
void SetFeatureWindow(Rect< int > featureWindow)
Set the feature window for this model.
Definition: training_set.hpp:812
int Index() const
Index of this object in the parent's collection.
Definition: training_set.hpp:725
void SetOrigin(Point2D< double > origin)
Set the origin of the model in terms of coordinates inside the feature window.
Definition: training_set.hpp:834
Rect< int > GetMaxFeatureWindow() const
Retrieve the maximum values that may be set as feature window for this model.
Definition: training_set.hpp:898
void SetName(const String &name)
Set the name of the model.
Definition: training_set.hpp:767
Rect< int > FeatureWindow() const
Get the feature window for this model.
Definition: training_set.hpp:799
void * Handle() const noexcept
Classic API MTSMODEL handle.
Definition: training_set.hpp:953
Class that maintains the collection of Training Images inside a Minos Training Set.
Definition: training_set.hpp:394
A Minos Training Set from which a classifier can be generated.
Definition: training_set.hpp:1160
static TypedRange< std::unique_ptr< TrainingSet >, std::uint8_t, RANGE >::type FromBuffer(const RANGE &buffer)
Recreate a serialized Minos training set from a byte array.
Definition: training_set.hpp:1252
std::unique_ptr< TrainingSet > Transform(Matrix2D transformation)
Generate a new training set by transforming this training set with a 2x2 transformation matrix.
Definition: training_set.hpp:1321
std::vector< SearchResult > CheckConsistency(double threshold, double density=1.0)
Test all images in the parent training set for instances of this model that might have been forgotten...
Definition: training_set.hpp:1338
double CorrelationThreshold() const
Gets the correlation threshold. The correlation value under which Minos proposes generating a new mod...
Definition: training_set.hpp:1518
int ClassCount() const
The number of identifiable classes inside this training set.
Definition: training_set.hpp:1354
static std::unique_ptr< TrainingSet > FromBuffer(const void *buffer, size_t size)
Recreate a serialized Minos training set from a byte array.
Definition: training_set.hpp:1236
void SetIsModified(bool isModified)
Set a flag that informs about unsaved modifications to the training set.
Definition: training_set.hpp:1439
ModelInfoCollection & Models()
The models contained in this training set.
Definition: training_set.hpp:1403
TrainingSet(const String &fileName)
Load a saved training set from a file.
Definition: training_set.hpp:1205
static std::unique_ptr< TrainingSet > FromHandle(HandleGuard< TrainingSet > &&guard)
Creates training set from a classic API handle.
Definition: training_set.hpp:1278
TrainingSet()
Create an empty training set.
Definition: training_set.hpp:1195
String Comment() const
Get the comment assigned to the training set at generation time.
Definition: training_set.hpp:1474
std::vector< std::uint8_t > ToBuffer() const
Serializes the training set into a buffer.
Definition: training_set.hpp:1306
void SetExpectationRadius(double expectationRadius)
Set the expectation radius - the radius that is searched for the best occurrence of a sample,...
Definition: training_set.hpp:1508
void Save(const String &fileName) const
Write the training set to a file.
Definition: training_set.hpp:1294
Rect< int > Extent() const
Extent of the classes in the training set relative to the anchor point.
Definition: training_set.hpp:1449
bool IsModified() const
Get a flag that informs about unsaved modifications to the training set.
Definition: training_set.hpp:1425
void SetComment(String comment)
Set the comment assigned to the training set at generation time.
Definition: training_set.hpp:1486
int InstancesTotal() const
Total number of instances currently trained in this training set.
Definition: training_set.hpp:1377
static std::unique_ptr< TrainingSet > Load(const String &fileName)
Load a saved training set from a file.
Definition: training_set.hpp:1224
Rect< int > LastFeatureWindow() const
Feature window of the last model that has been created for the training set.
Definition: training_set.hpp:1461
void SetCorrelationThreshold(double correlationThreshold)
Set the correlation threshold - the correlation value below which Minos will suggest the generation o...
Definition: training_set.hpp:1530
String FileName() const
Name of the file, from which this training set was loaded (empty string if this image list was neithe...
Definition: training_set.hpp:1413
void * Handle() const noexcept
Classic API CLF handle.
Definition: training_set.hpp:1265
ImageInfoCollection & Images()
The images contained in this training set.
Definition: training_set.hpp:1390
InstanceInfoCollection & Instances()
The instances contained in this training set.
Definition: training_set.hpp:1367
double ExpectationRadius() const
Get the expectation radius - the radius that is searched for the best occurrence of a sample,...
Definition: training_set.hpp:1496
T X() const noexcept
Gets the x-component of the point.
Definition: point_2d.hpp:86
T Y() const noexcept
Gets the y-component of the point.
Definition: point_2d.hpp:106
T Bottom() const noexcept
Gets bottom row of the rectangle (still inside the rectangle).
Definition: rect.hpp:151
T Top() const noexcept
Gets first row of the rectangle.
Definition: rect.hpp:111
T Right() const noexcept
Gets rightmost column of the rectangle (still inside the rectangle).
Definition: rect.hpp:131
T Left() const noexcept
Gets first column of the rectangle.
Definition: rect.hpp:91
bool operator==(const ClassifierModelInfo &lhs, const ClassifierModelInfo &rhs) noexcept
Comparison operator for ClassifierModelInfo objects.
Definition: classifier.hpp:159
bool operator!=(const ClassifierModelInfo &lhs, const ClassifierModelInfo &rhs) noexcept
Comparison operator for ClassifierModelInfo objects.
Definition: classifier.hpp:146
Root namespace for the Image Manager interface.
Definition: c_barcode.h:15
char Char
Character type for wide characters or unicode characters.
Definition: string.hpp:70
Point2D< int > Round(const Point2D< T > &rhs) noexcept
Round to an integer point.
Definition: point_2d.hpp:380