EOCR2 Class
Manages a complete context for the font-dependent printed character reader implemented in EasyOCR2.
Namespace: Euresys::Open_eVision
License(s): EasyOCR2
Constructors
Properties
Outputs an EOCR2Text
structure containing the detailed detection and recognition results.
Sets which character types are expected when EOCR2::EnabledTopology
is false.
The set of expected character types is represented by a bitwise combination of different EasyOCR2CharacterFilter
.
Sets the EOCR2CharacterDatabase
used for recognizing text.
Sets the expected character height in pixels.
Sets the CharsMaxFragmentation parameter for the segmentation algorithm. This will determine the minimum size a blob Synonym of object. should be in order to be considered a potential character. A high setting will allow only larger blobs, a low setting will also allow smaller blobs.
The minimum blob size to be considered a potential character is defined as:
CharsMaxFragmentation * CharsHeight * CharsWidth
Sets the CharSpacingBias parameter for the topology fitting algorithm, which optimizes the spacing of the bounding boxes to optimally fit the detected blobs. This will determine whether the method is biased toward finding narrow spacing, wide spacing or is neutral.
This property is deprecated: Use EOCR2::CharsWidthRange
instead.
Sets the CharsWidthBias parameter for the topology fitting algorithm, which optimizes the width of the bounding boxes to optimally fit the detected blobs. This will determine whether the method is biased toward finding narrow boxes, wide boxes or is neutral.
Sets the range of expected character widths in pixels.
This property is deprecated: Use EOCR2::CharsWidthRange
instead.
Sets the EOCR2Classifier parameter for the recognition algorithm. This will determine which classifier will be used for the recognition.
Sets the DetectionDelta parameter for the segmentation algorithm. This will determine the range of grayscale-values used to determine the stability of a blob. A low setting will make the algorithm more sensitive to noise, a high setting will make the algorithm insensitive to blobs with low contrast to the background.
Sets the EOCR2DetectionMethod parameter for the topology fitting algorithm, which will place text boxes on the segmentation results, matching the given topology.
Sets whether EOCR2 detection should split or not segmented blobs into multiple characters if they are wider than the given character width range parameter.
The default setting for this parameter is false and it is only applicable when the topology is not required or when the detectionMethod is set to EOCR2DetectionMethod.Proportional
.
Sets whether the topology is required or not. If it is, EOCR2
will try to detect the topology accordingly with the EOCR2DetectionMethod
parameter.
The default setting for this parameter is true and topology has to be given with EOCR2::Topology
.
Sets/Gets whether EOCR2 uses a GPU to accelerate its processing.
Sets whether EOCR2 allows or not the detection of characters whose size (width and height) is out of the size parameters if they are in the vicinity of characters in valid size range. The default setting for this parameter is true and it is only applicable when the topology is not required.
Sets whether EOCR2 segmentation should do or not do an extra pass to determine the best threshold using the EOCR2SegmentationMethod.Global
segmentation method.
The default setting for this parameter is false and it is only applicable when the segmentation method is set to EOCR2SegmentationMethod.Global
.
Sets/Gets the fraction of the image pixels that will be set below the threshold used when the segmentation method is set to EOCR2SegmentationMethod.Global
.
It is only used when the GlobalSegmentationThresholdMode value is EThresholdMode.Relative
.
Sets/Gets the EThresholdMode
used when the segmentation method is set to EOCR2SegmentationMethod.Global
. From the EThresholdMode
, a threshold will be computed during the segmentation.
While using EasyOCR2TextPolarity.WhiteOnBlack
, pixels above or equal to the threshold will be segmented. While using EasyOCR2TextPolarity.BlackOnWhite
, pixels under the threshold will be segmented.
Sets/gets the GPUs to use when computing.
Sets the maxVariation parameter for the segmentation algorithm. This parameter determines how stable a blob in the image should be in order to be considered a potential character, a region with clearly defined edges is generally considered stable while a blurry region is not. A high setting allows more unstable blobs, a low setting allows only very stable blobs.
Sets the NumDetectionPasses parameter for the topology fitting algorithm, which will place text boxes on the segmentation results (blobs), matching the given topology. The first pass will consider all blobs, subsequent passes will only consider those blobs that are inside the text boxes from the previous pass, sometimes resulting in a more optimal fit.
Sets the range of expected spaces between words as a fraction of the character width.
Sets whether EOCR2 groups or does not group the blobs believed to belong to the same character. The default setting for this parameter is true and it is only applicable when the topology is not required.
Sets the EOCR2SegmentationMethod parameter for the segmentation algorithm, which will detect blobs in the image.
Sets the TextAngleRange parameter for the topology fitting algorithm, which will attempt to find the angle of the text in the image with respect to the horizontal.
This will determine the center of the range of angles that will be tested, defined as:
TextAngleRange.min() <= angle <= TextAngleRange.max()
This property is deprecated: Use EOCR2::TextAngleRange
instead
This property is deprecated: Use EOCR2::TextAngleRange
instead
Sets the TextPolarity parameter for the segmentation algorithm. This will determine whether the algorithm searches for light blobs in a dark background or for dark blobs in a light background.
Time-out for the EOCR2::Read
, EOCR2::Detect
and EOCR2::Recognize
methods.
Sets the topology of the text that should be found in the image. A modified version of Regex expressions are used, where:
- .(dot) represents any character (not including a space).
- L represents a letter.
- Lu represents an uppercase letter.
- Ll represents a lowercase letter.
- N represents a digit.
- P represents a punctuation character
!"#&'()*,-./:;<>?[\]_{|}~
- S represents the symbols
$;+-<=>|~
- \n represents a line break.
- ' ' (space) represents a space between two words.
Combinations can be made, for example: [LN]
represents an alpha-numeric character.
To specify multiple characters, simply add {n}
at the end for n characters.
If the amount of characters is uncertain, specify {n,m}
for a minimum of n characters and a maximum of m characters.
The topology "[LuN]{3,5}PN{4} \n .{5} LL
" represents a text comprised of 2 lines:
The first line has 1 word composed of 3 to 5 uppercase alpha-numeric characters, followed by a punctuation character and 4 numbers.
The second line has 2 words. The first word comprises of 5 wildcard characters, the second word has 2 alphabetic characters (upper- or lowercase).
Methods
Reads reference characters from disk and adds them to the database used for text recognition. The characters can be read from a trueType (.ttf/.ttc) file or from an EasyOCR2 database file.
Adds the EOCR2Classifier for the given specific symbol combination during the recognition instead of the one set by EOCR2::Classifier
.
Clears the reference character database from this EOCR2
instance.
Clear the current detected text if it exists.
Finds the text in an image as follows:
- Detects potential characters in the image following the given text polarity.
- Fits bounding boxes to the detected characters, following the given topology and character width/height.
- Extracts the detected characters from the image.
The detected characters are output as an EOCR2Text
structure.
Draws the bounding boxes found by the topology detection algorithm.
This method is deprecated: Use the overload of EOCR2::DrawDetection
taking an EDrawAdapter
by using an instance of EWindowsDrawAdapter
.
Draws the recognized text next to the character bounding box in the image.
This method is deprecated: Use the overload of EOCR2::DrawRecognition
taking an EDrawAdapter
by using an instance of EWindowsDrawAdapter
.
Draws the blobs found by the segmentation algorithm.
This method is deprecated: Use the overload of EOCR2::DrawSegmentation
taking an EDrawAdapter
by using an instance of EWindowsDrawAdapter
.
Gets the EOCR2Classifier for the given specific symbol combination during the recognition instead of the one set by EOCR2::Classifier
.
Tests the cursor position for the presence of a character. If one is present under the cursor, it returns true and fills the EOCR2Char
object In a general content, the term object should be understood with the meaning of a class instance. In EasyObject, an object is a maximally-sized area of adjacent connected pixels belonging to the layer foreground. passed as parameter.
Tests the cursor position for the presence of a line. If one is present under the cursor, it returns true and fills the EOCR2Line
object passed as parameter.
Tests the cursor position for the presence of a text. If one is present under the cursor, it returns true and fills the EOCR2Text
object passed as parameter.
Tests the cursor position for the presence of a word. If one is present under the cursor, it returns true and fills the EOCR2Word
object passed as parameter.
Loads a model, containing parameter settings used for all operations in EOCR2::EOCR2
, from disk.
Performs all steps required for reading text from an image:
- Detects potential characters in the image following the given text polarity and character width/height.
- Fits bounding boxes to the detected characters, following the given topology and character width/height.
- Recognizes the detected characters using the given reference character database.
The read text is output as a string.
Removes the EOCR2Classifier for the given specific symbol combination during the recognition so the one set by EOCR2::Classifier
will be used.
Saves the model to disk, containing the current parameter setting used for all operations in EOCR2
.
Saves the current reference character database to disk.
EOCR2 Class
Manages a complete context for the font-dependent printed character reader implemented in EasyOCR2.
Namespace: Euresys.Open_eVision
License(s): EasyOCR2
Constructors
Properties
Sets which character types are expected when EOCR2.EnabledTopology
is false.
The set of expected character types is represented by a bitwise combination of different EasyOCR2CharacterFilter
.
Sets the EOCR2CharacterDatabase
used for recognizing text.
Sets the expected character height in pixels.
Sets the CharsMaxFragmentation parameter for the segmentation algorithm. This will determine the minimum size a blob should be in order to be considered a potential character. A high setting will allow only larger blobs, a low setting will also allow smaller blobs.
The minimum blob size to be considered a potential character is defined as:
CharsMaxFragmentation * CharsHeight * CharsWidth
Sets the CharSpacingBias parameter for the topology fitting algorithm, which optimizes the spacing of the bounding boxes to optimally fit the detected blobs. This will determine whether the method is biased toward finding narrow spacing, wide spacing or is neutral.
This property is deprecated: Use EOCR2.CharsWidthRange
instead.
Sets the CharsWidthBias parameter for the topology fitting algorithm, which optimizes the width of the bounding boxes to optimally fit the detected blobs. This will determine whether the method is biased toward finding narrow boxes, wide boxes or is neutral.
Sets the range of expected character widths in pixels.
This property is deprecated: Use EOCR2.CharsWidthRange
instead.
Sets the EOCR2Classifier parameter for the recognition algorithm. This will determine which classifier will be used for the recognition.
Sets the DetectionDelta parameter for the segmentation algorithm. This will determine the range of grayscale-values used to determine the stability of a blob. A low setting will make the algorithm more sensitive to noise, a high setting will make the algorithm insensitive to blobs with low contrast to the background.
Sets the EOCR2DetectionMethod parameter for the topology fitting algorithm, which will place text boxes on the segmentation results, matching the given topology.
Sets whether EOCR2 detection should split or not segmented blobs into multiple characters if they are wider than the given character width range parameter.
The default setting for this parameter is false and it is only applicable when the topology is not required or when the detectionMethod is set to EOCR2DetectionMethod.Proportional
.
Sets whether the topology is required or not. If it is, EOCR2
will try to detect the topology accordingly with the EOCR2DetectionMethod
parameter.
The default setting for this parameter is true and topology has to be given with EOCR2.Topology
.
Sets/Gets whether EOCR2 uses a GPU to accelerate its processing.
Sets whether EOCR2 allows or not the detection of characters whose size (width and height) is out of the size parameters if they are in the vicinity of characters in valid size range. The default setting for this parameter is true and it is only applicable when the topology is not required.
Sets whether EOCR2 segmentation should do or not do an extra pass to determine the best threshold using the EOCR2SegmentationMethod.Global
segmentation method.
The default setting for this parameter is false and it is only applicable when the segmentation method is set to EOCR2SegmentationMethod.Global
.
Sets/Gets the fraction of the image pixels that will be set below the threshold used when the segmentation method is set to EOCR2SegmentationMethod.Global
.
It is only used when the GlobalSegmentationThresholdMode value is EThresholdMode.Relative
.
Sets/Gets the EThresholdMode
used when the segmentation method is set to EOCR2SegmentationMethod.Global
. From the EThresholdMode
, a threshold will be computed during the segmentation.
While using EasyOCR2TextPolarity.WhiteOnBlack
, pixels above or equal to the threshold will be segmented. While using EasyOCR2TextPolarity.BlackOnWhite
, pixels under the threshold will be segmented.
Sets/gets the GPUs to use when computing.
Sets the maxVariation parameter for the segmentation algorithm. This parameter determines how stable a blob in the image should be in order to be considered a potential character, a region with clearly defined edges is generally considered stable while a blurry region is not. A high setting allows more unstable blobs, a low setting allows only very stable blobs.
Sets the NumDetectionPasses parameter for the topology fitting algorithm, which will place text boxes on the segmentation results (blobs), matching the given topology. The first pass will consider all blobs, subsequent passes will only consider those blobs that are inside the text boxes from the previous pass, sometimes resulting in a more optimal fit.
Sets the range of expected spaces between words as a fraction of the character width.
Sets whether EOCR2 groups or does not group the blobs believed to belong to the same character. The default setting for this parameter is true and it is only applicable when the topology is not required.
Sets the EOCR2SegmentationMethod parameter for the segmentation algorithm, which will detect blobs in the image.
Sets the TextAngleRange parameter for the topology fitting algorithm, which will attempt to find the angle of the text in the image with respect to the horizontal.
This will determine the center of the range of angles that will be tested, defined as:
TextAngleRange.min() <= angle <= TextAngleRange.max()
This property is deprecated: Use EOCR2.TextAngleRange
instead
This property is deprecated: Use EOCR2.TextAngleRange
instead
Sets the TextPolarity parameter for the segmentation algorithm. This will determine whether the algorithm searches for light blobs in a dark background or for dark blobs in a light background.
Time-out for the EOCR2.Read
, EOCR2.Detect
and EOCR2.Recognize
methods.
Sets the topology of the text that should be found in the image. A modified version of Regex expressions are used, where:
- .(dot) represents any character (not including a space).
- L represents a letter.
- Lu represents an uppercase letter.
- Ll represents a lowercase letter.
- N represents a digit.
- P represents a punctuation character
!"#&'()*,-./:;<>?[\]_{|}~
- S represents the symbols
$;+-<=>|~
- \n represents a line break.
- ' ' (space) represents a space between two words.
Combinations can be made, for example: [LN]
represents an alpha-numeric character.
To specify multiple characters, simply add {n}
at the end for n characters.
If the amount of characters is uncertain, specify {n,m}
for a minimum of n characters and a maximum of m characters.
The topology "[LuN]{3,5}PN{4} \n .{5} LL
" represents a text comprised of 2 lines:
The first line has 1 word composed of 3 to 5 uppercase alpha-numeric characters, followed by a punctuation character and 4 numbers.
The second line has 2 words. The first word comprises of 5 wildcard characters, the second word has 2 alphabetic characters (upper- or lowercase).
Methods
Reads reference characters from disk and adds them to the database used for text recognition. The characters can be read from a trueType (.ttf/.ttc) file or from an EasyOCR2 database file.
Adds the EOCR2Classifier for the given specific symbol combination during the recognition instead of the one set by EOCR2.Classifier
.
Clears the reference character database from this EOCR2
instance.
Clear the current detected text if it exists.
Finds the text in an image as follows:
- Detects potential characters in the image following the given text polarity.
- Fits bounding boxes to the detected characters, following the given topology and character width/height.
- Extracts the detected characters from the image.
The detected characters are output as an EOCR2Text
structure.
Draws the bounding boxes found by the topology detection algorithm.
This method is deprecated: Use the overload of EOCR2.DrawDetection
taking an EDrawAdapter
by using an instance of EWindowsDrawAdapter
.
Draws the recognized text next to the character bounding box in the image.
This method is deprecated: Use the overload of EOCR2.DrawRecognition
taking an EDrawAdapter
by using an instance of EWindowsDrawAdapter
.
Draws the blobs found by the segmentation algorithm.
This method is deprecated: Use the overload of EOCR2.DrawSegmentation
taking an EDrawAdapter
by using an instance of EWindowsDrawAdapter
.
Gets the EOCR2Classifier for the given specific symbol combination during the recognition instead of the one set by EOCR2.Classifier
.
Tests the cursor position for the presence of a character. If one is present under the cursor, it returns true and fills the EOCR2Char
object passed as parameter.
Tests the cursor position for the presence of a line. If one is present under the cursor, it returns true and fills the EOCR2Line
object passed as parameter.
Tests the cursor position for the presence of a text. If one is present under the cursor, it returns true and fills the EOCR2Text
object passed as parameter.
Tests the cursor position for the presence of a word. If one is present under the cursor, it returns true and fills the EOCR2Word
object passed as parameter.
Loads a model, containing parameter settings used for all operations in EOCR2.EOCR2
, from disk.
Performs all steps required for reading text from an image:
- Detects potential characters in the image following the given text polarity and character width/height.
- Fits bounding boxes to the detected characters, following the given topology and character width/height.
- Recognizes the detected characters using the given reference character database.
The read text is output as a string.
Removes the EOCR2Classifier for the given specific symbol combination during the recognition so the one set by EOCR2.Classifier
will be used.
Saves the model to disk, containing the current parameter setting used for all operations in EOCR2
.
Saves the current reference character database to disk.
EOCR2 Class
Manages a complete context for the font-dependent printed character reader implemented in EasyOCR2.
Module: open_evision
License(s): EasyOCR2
Constructors
Properties
Sets which character types are expected when EOCR2.EnabledTopology
is false.
The set of expected character types is represented by a bitwise combination of different EasyOCR2CharacterFilter
.
Sets the EOCR2CharacterDatabase
used for recognizing text.
Sets the expected character height in pixels.
Sets the CharsMaxFragmentation parameter for the segmentation algorithm. This will determine the minimum size a blob should be in order to be considered a potential character. A high setting will allow only larger blobs, a low setting will also allow smaller blobs.
The minimum blob size to be considered a potential character is defined as:
CharsMaxFragmentation * CharsHeight * CharsWidth
Sets the CharSpacingBias parameter for the topology fitting algorithm, which optimizes the spacing of the bounding boxes to optimally fit the detected blobs. This will determine whether the method is biased toward finding narrow spacing, wide spacing or is neutral.
This property is deprecated: Use EOCR2.CharsWidthRange
instead.
Sets the CharsWidthBias parameter for the topology fitting algorithm, which optimizes the width of the bounding boxes to optimally fit the detected blobs. This will determine whether the method is biased toward finding narrow boxes, wide boxes or is neutral.
Sets the range of expected character widths in pixels.
This property is deprecated: Use EOCR2.CharsWidthRange
instead.
Sets the EOCR2Classifier parameter for the recognition algorithm. This will determine which classifier will be used for the recognition.
Sets the DetectionDelta parameter for the segmentation algorithm. This will determine the range of grayscale-values used to determine the stability of a blob. A low setting will make the algorithm more sensitive to noise, a high setting will make the algorithm insensitive to blobs with low contrast to the background.
Sets the EOCR2DetectionMethod parameter for the topology fitting algorithm, which will place text boxes on the segmentation results, matching the given topology.
Sets whether EOCR2 detection should split or not segmented blobs into multiple characters if they are wider than the given character width range parameter.
The default setting for this parameter is false and it is only applicable when the topology is not required or when the detectionMethod is set to EOCR2DetectionMethod.Proportional
.
Sets whether the topology is required or not. If it is, EOCR2
will try to detect the topology accordingly with the EOCR2DetectionMethod
parameter.
The default setting for this parameter is true and topology has to be given with EOCR2.Topology
.
Sets/Gets whether EOCR2 uses a GPU to accelerate its processing.
Sets whether EOCR2 allows or not the detection of characters whose size (width and height) is out of the size parameters if they are in the vicinity of characters in valid size range. The default setting for this parameter is true and it is only applicable when the topology is not required.
Sets whether EOCR2 segmentation should do or not do an extra pass to determine the best threshold using the EOCR2SegmentationMethod.Global
segmentation method.
The default setting for this parameter is false and it is only applicable when the segmentation method is set to EOCR2SegmentationMethod.Global
.
Sets/Gets the fraction of the image pixels that will be set below the threshold used when the segmentation method is set to EOCR2SegmentationMethod.Global
.
It is only used when the GlobalSegmentationThresholdMode value is EThresholdMode.Relative
.
Sets/Gets the EThresholdMode
used when the segmentation method is set to EOCR2SegmentationMethod.Global
. From the EThresholdMode
, a threshold will be computed during the segmentation.
While using EasyOCR2TextPolarity.WhiteOnBlack
, pixels above or equal to the threshold will be segmented. While using EasyOCR2TextPolarity.BlackOnWhite
, pixels under the threshold will be segmented.
Sets/gets the GPUs to use when computing.
Sets the maxVariation parameter for the segmentation algorithm. This parameter determines how stable a blob in the image should be in order to be considered a potential character, a region with clearly defined edges is generally considered stable while a blurry region is not. A high setting allows more unstable blobs, a low setting allows only very stable blobs.
Sets the NumDetectionPasses parameter for the topology fitting algorithm, which will place text boxes on the segmentation results (blobs), matching the given topology. The first pass will consider all blobs, subsequent passes will only consider those blobs that are inside the text boxes from the previous pass, sometimes resulting in a more optimal fit.
Sets the range of expected spaces between words as a fraction of the character width.
Sets whether EOCR2 groups or does not group the blobs believed to belong to the same character. The default setting for this parameter is true and it is only applicable when the topology is not required.
Sets the EOCR2SegmentationMethod parameter for the segmentation algorithm, which will detect blobs in the image.
Sets the TextAngleRange parameter for the topology fitting algorithm, which will attempt to find the angle of the text in the image with respect to the horizontal.
This will determine the center of the range of angles that will be tested, defined as:
TextAngleRange.min() <= angle <= TextAngleRange.max()
This property is deprecated: Use EOCR2.TextAngleRange
instead
This property is deprecated: Use EOCR2.TextAngleRange
instead
Sets the TextPolarity parameter for the segmentation algorithm. This will determine whether the algorithm searches for light blobs in a dark background or for dark blobs in a light background.
Time-out for the EOCR2.Read
, EOCR2.Detect
and EOCR2.Recognize
methods.
Sets the topology of the text that should be found in the image.
A modified version of Regex expressions are used, where:
- .(dot) represents any character (not including a space).
- L represents a letter.
- Lu represents an uppercase letter.
- Ll represents a lowercase letter.
- N represents a digit.
- P represents a punctuation character !"#&'()*,-./:;<>?[\]_{|}~
- S represents the symbols $;+-<=>|~
- \n represents a line break.
- ' ' (space) represents a space between two words.
Combinations can be made, for example: [LN]
represents an alpha-numeric character.
To specify multiple characters, simply add {n}
at the end for n characters.
If the amount of characters is uncertain, specify {n,m}
for a minimum of n characters and a maximum of m characters.
The topology "[LuN]{3,5}PN{4} \n .{5} LL
" represents a text comprised of 2 lines:
The first line has 1 word composed of 3 to 5 uppercase alpha-numeric characters, followed by a punctuation character and 4 numbers.
The second line has 2 words. The first word comprises of 5 wildcard characters, the second word has 2 alphabetic characters (upper- or lowercase).
Methods
Reads reference characters from disk and adds them to the database used for text recognition. The characters can be read from a trueType (.ttf/.ttc) file or from an EasyOCR2 database file.
Adds the EOCR2Classifier for the given specific symbol combination during the recognition instead of the one set by EOCR2.Classifier
.
Clears the reference character database from this EOCR2
instance.
Clear the current detected text if it exists.
Finds the text in an image as follows:
- Detects potential characters in the image following the given text polarity.
- Fits bounding boxes to the detected characters, following the given topology and character width/height.
- Extracts the detected characters from the image.
The detected characters are output as an EOCR2Text
structure.
Draws the bounding boxes found by the topology detection algorithm.
Draws the recognized text next to the character bounding box in the image.
Draws the blobs found by the segmentation algorithm.
Gets the EOCR2Classifier for the given specific symbol combination during the recognition instead of the one set by EOCR2.Classifier
.
Tests the cursor position for the presence of a character. If one is present under the cursor, it returns true and fills the EOCR2Char
object passed as parameter.
Tests the cursor position for the presence of a line. If one is present under the cursor, it returns true and fills the EOCR2Line
object passed as parameter.
Tests the cursor position for the presence of a text. If one is present under the cursor, it returns true and fills the EOCR2Text
object passed as parameter.
Tests the cursor position for the presence of a word. If one is present under the cursor, it returns true and fills the EOCR2Word
object passed as parameter.
Loads a model, containing parameter settings used for all operations in EOCR2.__init__
, from disk.
Performs all steps required for reading text from an image:
- Detects potential characters in the image following the given text polarity and character width/height.
- Fits bounding boxes to the detected characters, following the given topology and character width/height.
- Recognizes the detected characters using the given reference character database.
The read text is output as a string.
Removes the EOCR2Classifier for the given specific symbol combination during the recognition so the one set by EOCR2.Classifier
will be used.
Saves the model to disk, containing the current parameter setting used for all operations in EOCR2
.
Saves the current reference character database to disk.