RecognitionSettings
Inheritance: java.lang.Object
public class RecognitionSettings
Settings for the image recognition. Contains elements that allow customizing the recognition process.
Constructors
Constructor | Description |
---|---|
RecognitionSettings() | Default constructor: set recognitionAreas null, linesFiltration false, autoSkew false, recognizeSingleLine false. |
RecognitionSettings(ArrayList | Constructor allows to set all options. |
RecognitionSettings(boolean recognizeSingleLine) | Constructor allows to set recognizeSingleLine. |
RecognitionSettings(ReceiptRecognitionSettings recSettings) | |
RecognitionSettings(InvoiceRecognitionSettings recSettings) | |
RecognitionSettings(IDCardRecognitionSettings recSettings) | |
RecognitionSettings(PassportRecognitionSettings recSettings) | |
RecognitionSettings(CarPlateRecognitionSettings recSettings) |
Methods
Method | Description |
---|---|
setRecognitionAreas(ArrayList | Sets the list of text areas for processing. |
setLinesFiltration(boolean linesFiltration) | Allows to recognize text in the tables (regions surrounded lines). |
setRecognizeSingleLine(boolean recognizeSingleLine) | Sets single-line image recognition. |
setLanguage(Language language) | |
setIgnoredCharacters(String characters) | Sets blacklist for recognition symbols. |
setThreadsCount(int threadsCount) | Gets or sets the number of threads for processing. |
setAllowedCharacters(CharactersAllowedType allowedCharacters) | Allowed characters set. |
setAllowedCharacters(String allowedCharacters) | Allowed characters set. |
setDetectAreasMode(DetectAreasMode detectAreasMode) | Determines the type of neural network used for areas detection. |
setUpscaleSmallFont(boolean upscaleSmallFont) | Allows you to use additional algorithms specifically for small font recognition. |
setAutomaticColorInversion(boolean automaticColorInversion) | Detect images with white text on dark/black background and automatically choose a special OCR algorithm for them. |
RecognitionSettings()
public RecognitionSettings()
Default constructor: set recognitionAreas null, linesFiltration false, autoSkew false, recognizeSingleLine false.
RecognitionSettings(ArrayList recognitionAreas, boolean recognizeSingleLine)
public RecognitionSettings(ArrayList<Rectangle> recognitionAreas, boolean recognizeSingleLine)
Constructor allows to set all options.
Parameters:
Parameter | Type | Description |
---|---|---|
recognitionAreas | java.util.ArrayList<java.awt.Rectangle> | Rectangles for recognition. |
recognizeSingleLine | boolean | True if the image contains only one line. |
RecognitionSettings(boolean recognizeSingleLine)
public RecognitionSettings(boolean recognizeSingleLine)
Constructor allows to set recognizeSingleLine. Default values in this case: detectAreas - false, autoSkew = false, recognitionAreas - null.
Parameters:
Parameter | Type | Description |
---|---|---|
recognizeSingleLine | boolean | True if the image contains only one line. |
RecognitionSettings(ReceiptRecognitionSettings recSettings)
public RecognitionSettings(ReceiptRecognitionSettings recSettings)
Parameters:
Parameter | Type | Description |
---|---|---|
recSettings | ReceiptRecognitionSettings |
RecognitionSettings(InvoiceRecognitionSettings recSettings)
public RecognitionSettings(InvoiceRecognitionSettings recSettings)
Parameters:
Parameter | Type | Description |
---|---|---|
recSettings | InvoiceRecognitionSettings |
RecognitionSettings(IDCardRecognitionSettings recSettings)
public RecognitionSettings(IDCardRecognitionSettings recSettings)
Parameters:
Parameter | Type | Description |
---|---|---|
recSettings | IDCardRecognitionSettings |
RecognitionSettings(PassportRecognitionSettings recSettings)
public RecognitionSettings(PassportRecognitionSettings recSettings)
Parameters:
Parameter | Type | Description |
---|---|---|
recSettings | PassportRecognitionSettings |
RecognitionSettings(CarPlateRecognitionSettings recSettings)
public RecognitionSettings(CarPlateRecognitionSettings recSettings)
Parameters:
Parameter | Type | Description |
---|---|---|
recSettings | CarPlateRecognitionSettings |
setRecognitionAreas(ArrayList recognitionAreas)
public void setRecognitionAreas(ArrayList<Rectangle> recognitionAreas)
Sets the list of text areas for processing. Allows to manually specify the areas with text for more accurate recognition. If custom areas are set setDetectAreasMode(DetectAreasMode) (DetectAreasMode)} not NONE or PreprocessingFilter.AutoSkew() (boolean)} properties will be ignored. Disables DetectAreas and AutoSkew.
Parameters:
Parameter | Type | Description |
---|---|---|
recognitionAreas | java.util.ArrayList<java.awt.Rectangle> | Rectangles for recognition. |
setLinesFiltration(boolean linesFiltration)
public void setLinesFiltration(boolean linesFiltration)
Allows to recognize text in the tables (regions surrounded lines).
Parameters:
Parameter | Type | Description |
---|---|---|
linesFiltration | boolean | false - allows increase performance and don’t detect tables and remove lines; otherwise - true. Disabled (false) by default. |
setRecognizeSingleLine(boolean recognizeSingleLine)
public void setRecognizeSingleLine(boolean recognizeSingleLine)
Sets single-line image recognition. Disabled (false) by default. Disable all the processing steps associated with splitting into lines. Set this parameter to true if your image contains only one line. Disables setRecognitionAreas(ArrayList) settings, so all areas settings will be ignored.
Parameters:
Parameter | Type | Description |
---|---|---|
recognizeSingleLine | boolean | True for single-line image |
setLanguage(Language language)
public void setLanguage(Language language)
Parameters:
Parameter | Type | Description |
---|---|---|
language | Language | Sets the language used for OCR. Multi-language (none) by default. |
setIgnoredCharacters(String characters)
public void setIgnoredCharacters(String characters)
Sets blacklist for recognition symbols.
Parameters:
Parameter | Type | Description |
---|---|---|
characters | java.lang.String | Characters excluded from recognition. |
setThreadsCount(int threadsCount)
public void setThreadsCount(int threadsCount)
Gets or sets the number of threads for processing. By default, 0 means that the image will be processed with the number of threads equal to your number of processors. ThreadsCount = 1 means that the image will be processed in the main thread.
Parameters:
Parameter | Type | Description |
---|---|---|
threadsCount | int | the number of threads that will be created for parallel recognition of image fragments. |
setAllowedCharacters(CharactersAllowedType allowedCharacters)
public void setAllowedCharacters(CharactersAllowedType allowedCharacters)
Allowed characters set. Determines the type of characters allowed for recognition result.
Parameters:
Parameter | Type | Description |
---|---|---|
allowedCharacters | CharactersAllowedType | contains enum @see CharactersAllowedType value. |
setAllowedCharacters(String allowedCharacters)
public void setAllowedCharacters(String allowedCharacters)
Allowed characters set. Determines the array of characters allowed for recognition result.
Parameters:
Parameter | Type | Description |
---|---|---|
allowedCharacters | java.lang.String | contains string of characters. |
setDetectAreasMode(DetectAreasMode detectAreasMode)
public void setDetectAreasMode(DetectAreasMode detectAreasMode)
Determines the type of neural network used for areas detection.
Parameters:
Parameter | Type | Description |
---|---|---|
detectAreasMode | DetectAreasMode | contains enum @see DetectAreasMode value. |
setUpscaleSmallFont(boolean upscaleSmallFont)
public void setUpscaleSmallFont(boolean upscaleSmallFont)
Allows you to use additional algorithms specifically for small font recognition. Useful for images with small size characters.
Parameters:
Parameter | Type | Description |
---|---|---|
upscaleSmallFont | boolean | contains boolean value - an upscaleSmallFont is set. |
setAutomaticColorInversion(boolean automaticColorInversion)
public void setAutomaticColorInversion(boolean automaticColorInversion)
Detect images with white text on dark/black background and automatically choose a special OCR algorithm for them.
Parameters:
Parameter | Type | Description |
---|---|---|
automaticColorInversion | boolean | contains boolean value - a automaticColorInversion is set. True by default. |