CVBpy 15.0
Classifier Class Reference

Load a saved classifier from a file. More...

Inherits object.

Public Member Functions

bool is_minos_16bit_classifier (self)
 Returns True if the classifier was generated by Minos16Bit, False otherwise. More...
 
Union[Tuple[str, cvb.minos.SearchResult], List[cvb.minos.SearchResult]] read (self, cvb.ImagePlane plane, cvb.Area2D start_aoi, cvb.Area2D ocr_aoi, Optional[float] density, int mode)
 Reads a string of characters with given mode or a list of characters with missing mode information. More...
 
None save (self, str file_name)
 Write the classifier to a file. More...
 
cvb.minos.SearchResult search (self, cvb.ImagePlane plane, int mode, Optional[cvb.Area2D] aoi, Optional[float] density)
 Search one object using this Minos classifier. More...
 
List[cvb.minos.SearchResultsearch_all (self, cvb.ImagePlane plane, int locality, Optional[cvb.Area2D] aoi, Optional[float] density=1.0)
 Search all objects using this Minos classifier. More...
 
cvb.minos.Classifier set_global_advance_vector (self, cvb.Point2D advance)
 Create a new classifier, that is a copy of this classifier, but with a global advance vector applied to all classes in the classifier. More...
 
cvb.minos.Classifier transform (self, cvb.Matrix2D transformation)
 Generate a new classifier by transforming this classifier with a 2 x 2 transformation matrix. More...
 

Properties

 comment = property
 str: Comment assigned to the classifier at generation time.
 
 contrast_trigger = property
 int: Trigger value for the contrast of features to be taken into account.
 
 extent = property
 cvb.Rect: Extent of the classes in the classifier relative to the anchor point.
 
 file_name = property
 str: Name of the file from which this classifier was loaded (empty string, if this image list was neither loaded nor saved since its construction).
 
 learn_parameters = property
 cvb.minos.LearnParameters: Name of the training set from which this classifier was generated.
 
 quality_measure = property
 int: Type of quality feedback from the classifier.
 
 threshold = property
 float: Threshold for search operations with normalized quality feedback.
 
 training_set_name = property
 str: Name of the training set from which this classifier was generated.
 

Detailed Description

Load a saved classifier from a file.

Instantiates a Classifier object.

Parameters

file_name : str Name of the file to be loaded.

Examples

Example from QmlMinos tutorial (OCR reading):

self._classifier = cvb.minos.Classifier(os.path.join(cvb.install_path(), "tutorial", "Minos", "Images", "OCR", "Training Set", "Numbers.clf"))
Load a saved classifier from a file.
Definition: __init__.py:29
str install_path()
Directory Common Vision Blox has been installed to.
Definition: __init__.py:8318

Member Function Documentation

◆ is_minos_16bit_classifier()

bool is_minos_16bit_classifier (   self)

Returns True if the classifier was generated by Minos16Bit, False otherwise.

Returns

bool True if generated by Minos16Bit, False otherwise.

◆ read()

Union[Tuple[str, cvb.minos.SearchResult], List[cvb.minos.SearchResult]] read (   self,
cvb.ImagePlane  plane,
cvb.Area2D  start_aoi,
cvb.Area2D  ocr_aoi,
Optional[float]  density,
int  mode 
)

Reads a string of characters with given mode or a list of characters with missing mode information.

Parameters

plane : cvb.ImagePlane Image plane to read on (1, 2).

start_aoi : cvb.Area2D Area in which to start the read operation (1, 2).

ocr_aoi : cvb.Area2D Area to be used for the intermediate read steps; this area will be applied relative to the expected position of the next character and is typically only a few pixels wide and high (1, 2).

density : Optional[float] Density at which to search ([0...1]) (1, 2).

mode : int Read mode (see cvb.minos.ReadMode). (2)

Returns

Union[Tuple[str, cvb.minos.SearchResult], List[cvb.minos.SearchResult]] The string that has been read by this function and the first or last character that has been read (depending on the value of the mode parameter), or the list of characters that has been read by this function.

Examples

Example from QmlMinos tutorial (OCR reading):

search_result = self._classifier.read(plane, read_aoi, OCR_AOI)
stream = ""
for i in range(len(search_result)):
stream += search_result[i].name

◆ save()

None save (   self,
str  file_name 
)

Write the classifier to a file.

Parameters

file_name : str Path to save to.

◆ search()

cvb.minos.SearchResult search (   self,
cvb.ImagePlane  plane,
int  mode,
Optional[cvb.Area2D aoi,
Optional[float]  density 
)

Search one object using this Minos classifier.

Parameters

plane : cvb.ImagePlane Image plane to search on.

mode : int Search mode to be used (see cvb.minos.SearchMode).

aoi : Optional[cvb.Area2D] Area to search in.

density : Optional[float] Density at which to search ([0...1]).

Returns

cvb.minos.SearchResult The found result (empty SearchResult if none was found).

◆ search_all()

List[cvb.minos.SearchResult] search_all (   self,
cvb.ImagePlane  plane,
int  locality,
Optional[cvb.Area2D aoi,
Optional[float]   density = 1.0 
)

Search all objects using this Minos classifier.

Parameters

plane : cvb.ImagePlane Image plane to search on.

locality : int Radius within which no better solution may exist.

aoi : Optional[cvb.Area2D] Area to search in.

density : Optional[float] Density at which to search ([0...1]).

Returns

List[cvb.minos.SearchResult] List of found results.

◆ set_global_advance_vector()

cvb.minos.Classifier set_global_advance_vector (   self,
cvb.Point2D  advance 
)

Create a new classifier, that is a copy of this classifier, but with a global advance vector applied to all classes in the classifier.

Parameters

advance : cvb.Point2D Advance vector to apply globally.

Returns

cvb.minos.Classifier The new classifier.

◆ transform()

cvb.minos.Classifier transform (   self,
cvb.Matrix2D  transformation 
)

Generate a new classifier by transforming this classifier with a 2 x 2 transformation matrix.

Parameters

transformation : cvb.Matrix2D Matrix with which to transform the geometry of this classifier.

Returns

cvb.minos.Classifier The transformed classifier.