public final class OCRConfig extends Object
Configuration for OCR system.
OcrEngine ocr = new OcrEngine(); ocr.getConfig().setNeedRotationCorrection(false);
| Constructor and Description |
|---|
OCRConfig()
Creates example of
OCRConfig with default parameteres values |
| Modifier and Type | Method and Description |
|---|---|
void |
addRecognitionBlock(IRecognitionBlock recognitionBlock)
Adds a rectangular block to user defined RecognitionBlocks
|
void |
clearRecognitionBlocks()
Clear recognition blocks array.
|
AdjustRotationMode |
getAdjustRotation()
Gets a value of adjust rotation mode
AdjustRotationMode. |
double |
getAdjustRotationAngle()
Gets a value of clockwise rotation angle, in degrees.
|
AdjustUpsideDownRotationMode |
getAdjustUpsideDownRotation()
Gets a value of adjust upsidedown rotation mode
AdjustUpsideDownRotationMode. |
CorrectionFilters |
getCorrectionFilters()
Gets filters for correction before recognition
|
boolean |
getDeleteTableLines()
Gets a value that indicates whether need to find and delete table lines in document
Don't use this property unnecessarily, because it may remove some meaningful information from the image and will increase total processing time
|
boolean |
getDetectReadingOrder()
Gets a value that indicates whether special reading order detection operation must be applied to textblocks
Default value is TRUE
If OCR process works too much time or is not responding, try to set this property to FALSE
|
boolean |
getDetectTextRegions()
Gets a value indicating whether automatical detection of the regions with text must be used.
|
IDictionaryReader |
getDictionaryReader()
Gets any of available dictionary readers for post processing, if not set, post processing is not turned on.
|
boolean |
getDoSpellingCorrection()
Gets a value indicating whether automatic spelling correction should be applied.
|
int |
getProbabilityRow()
Gets row with probable symbols to return probable symbols from.
|
boolean |
getProcessColoredBackground()
Turn on this option if input image have complex colored background, and standard method of thresholding work bad
|
int |
getQuantizationPalleteSize()
It is advanced option, which control number of colors to image pallete while quantization; this option make sence olny if ProcessColoredBackground is true; defalt value if 5
|
List<IRecognitionBlock> |
getRecognitionBlocks()
User defined blocks that determines page layout
|
boolean |
getRemoveNonText()
Set this parameter to TRUE if image contains non-text components (e.g.
|
boolean |
getUseDefaultDictionaries()
If getDictionaryReader() is null, this method indicates whether to use default dictionaries
|
void |
setAdjustRotation(AdjustRotationMode value)
Sets a value of adjust rotation mode
AdjustRotationMode. |
void |
setAdjustRotationAngle(double value)
Sets a value of clockwise rotation angle, in degrees.
|
void |
setAdjustUpsideDownRotation(AdjustUpsideDownRotationMode value)
Sets a value of adjust upsidedown rotation mode
AdjustUpsideDownRotationMode. |
void |
setCorrectionFilters(CorrectionFilters value)
Sets filters for correction before recognition
|
void |
setDeleteTableLines(boolean value)
Sets a value that indicates whether need to find and delete table lines in document
Don't use this property unnecessarily, because it may remove some meaningful information from the image and will increase total processing time
|
void |
setDetectReadingOrder(boolean value)
Sets a value that indicates whether special reading order detection operation must be applied to textblocks
Default value is TRUE
If OCR process works too much time or is not responding, try to set this property to FALSE
|
void |
setDetectTextRegions(boolean value)
Sets a value indicating whether automatical detection of the regions with text must be used.
|
void |
setDictionaryReader(IDictionaryReader value)
Sets available dictionary readers for post processing.
|
void |
setDoSpellingCorrection(boolean value)
Sets a value indicating whether automatic spelling correction should be applied.
|
void |
setProbabilityRow(int value)
Sets row with probable symbols to return probable symbols from.
|
void |
setProcessColoredBackground(boolean value)
Turn on this option if input image have complex colored background, and standard method of thresholding work bad
|
void |
setQuantizationPalleteSize(int value)
It is advanced option, which control number of colors to image pallete while quantization; this option make sence olny if ProcessColoredBackground is true; defalt value if 5
|
void |
setRemoveNonText(boolean value)
Set this parameter to TRUE if image contains non-text components (e.g.
|
void |
setUseDefaultDictionaries(boolean value)
If getDictionaryReader() is null, this method specifies whether to use default dictionaries
|
public OCRConfig()
Creates example of OCRConfig with default parameteres values
public void addRecognitionBlock(IRecognitionBlock recognitionBlock)
Adds a rectangular block to user defined RecognitionBlocks
recognitionBlock - a block to addpublic void clearRecognitionBlocks()
Clear recognition blocks array.
public AdjustRotationMode getAdjustRotation()
Gets a value of adjust rotation mode AdjustRotationMode. Possible values:
AdjustRotationMode.Automatic - skew angle is defined automatically (this may take some time but will improve recognition quality)
AdjustRotationMode.UserDefined - image is rotated on angle defined in AdjustRotationAngle
AdjustRotationMode.Disabled - no image rotation will be applied
public double getAdjustRotationAngle()
Gets a value of clockwise rotation angle, in degrees. Use only when AdjustRotation is equal AdjustRotationMode.UserDefined.
public AdjustUpsideDownRotationMode getAdjustUpsideDownRotation()
Gets a value of adjust upsidedown rotation mode AdjustUpsideDownRotationMode.
public CorrectionFilters getCorrectionFilters()
Gets filters for correction before recognition
public boolean getDeleteTableLines()
Gets a value that indicates whether need to find and delete table lines in document Don't use this property unnecessarily, because it may remove some meaningful information from the image and will increase total processing time
public boolean getDetectReadingOrder()
Gets a value that indicates whether special reading order detection operation must be applied to textblocks Default value is TRUE If OCR process works too much time or is not responding, try to set this property to FALSE
OcrEngine ocr = new OcrEngine(); ocr.setImage(ImageStream.fromFile("image.tiff")); ocr.getLanguages().addLanguage(Language.load("english")); ocr.getConfig().setDetectReadingOrder(false); FileInputStream resourceStream = new FileInputStream(resourceFileName); ocr.setResource(resourceStream); if (ocr.process()) { System.out.println(ocr.getText()); }
public boolean getDetectTextRegions()
Gets a value indicating whether automatical detection of the regions with text must be used. If this property is set to "true", manually set recognition blocks will be ignored.
public IDictionaryReader getDictionaryReader()
Gets any of available dictionary readers for post processing, if not set, post processing is not turned on.
public boolean getDoSpellingCorrection()
Gets a value indicating whether automatic spelling correction should be applied. Use this option to improve OCR result but notice that this will increase total processing time
public int getProbabilityRow()
Gets row with probable symbols to return probable symbols from. Default value is 0, so only the most probable symbols return.
public boolean getProcessColoredBackground()
Turn on this option if input image have complex colored background, and standard method of thresholding work bad
true if should process colored backgroundpublic int getQuantizationPalleteSize()
It is advanced option, which control number of colors to image pallete while quantization; this option make sence olny if ProcessColoredBackground is true; defalt value if 5
public List<IRecognitionBlock> getRecognitionBlocks()
User defined blocks that determines page layout
public boolean getRemoveNonText()
Set this parameter to TRUE if image contains non-text components (e.g. pictures, graphics) that should be detected and ignored during recognition process
public boolean getUseDefaultDictionaries()
If getDictionaryReader() is null, this method indicates whether to use default dictionaries
true if use default dictionariespublic void setAdjustRotation(AdjustRotationMode value)
Sets a value of adjust rotation mode AdjustRotationMode. Possible values:
AdjustRotationMode.Automatic - skew angle is defined automatically (this may take some time but will improve recognition quality)
AdjustRotationMode.UserDefined - image is rotated on angle defined in AdjustRotationAngle
AdjustRotationMode.Disabled - no image rotation will be applied
value - a value of adjust rotation modepublic void setAdjustRotationAngle(double value)
Sets a value of clockwise rotation angle, in degrees. Use only when AdjustRotation is equal AdjustRotationMode.UserDefined.
value - a value of clockwise rotation anglepublic void setAdjustUpsideDownRotation(AdjustUpsideDownRotationMode value)
Sets a value of adjust upsidedown rotation mode AdjustUpsideDownRotationMode.
Set it to AdjustUpsideDownRotationMode.Flip if text on image is upsidedown so it will be rotated to 180 degrees
value - a value of adjust upsidedown rotation modepublic void setCorrectionFilters(CorrectionFilters value)
Sets filters for correction before recognition
value - filters for correction before recognitionpublic void setDeleteTableLines(boolean value)
Sets a value that indicates whether need to find and delete table lines in document Don't use this property unnecessarily, because it may remove some meaningful information from the image and will increase total processing time
OcrEngine ocr = new OcrEngine(); ocr.setImage(ImageStream.fromFile("image.tiff")); ocr.getLanguages().addLanguage(Language.load("english")); ocr.getConfig().setDeleteTableLines(true); FileInputStream resourceStream = new FileInputStream(resourceFileName); ocr.setResource(resourceStream); if (ocr.process()) { System.out.println(ocr.getText()); }
value - a value that indicates whether need to find and delete table lines in documentpublic void setDetectReadingOrder(boolean value)
Sets a value that indicates whether special reading order detection operation must be applied to textblocks Default value is TRUE If OCR process works too much time or is not responding, try to set this property to FALSE
OcrEngine ocr = new OcrEngine(); ocr.setImage(ImageStream.fromFile("image.tiff")); ocr.getLanguages().addLanguage(Language.load("english")); ocr.getConfig().setDetectReadingOrder(false); FileInputStream resourceStream = new FileInputStream(resourceFileName); ocr.setResource(resourceStream); if (ocr.process()) { System.out.println(ocr.getText()); }
value - a value that indicates whether special reading order detection operation must be applied to textblockspublic void setDetectTextRegions(boolean value)
Sets a value indicating whether automatical detection of the regions with text must be used. If this property is set to "true", manually set recognition blocks will be ignored.
value - a value indicating whether automatical detection of the regions with text must be usedpublic void setDictionaryReader(IDictionaryReader value)
Sets available dictionary readers for post processing. This value (if not null) overrides value set by setUseDefaultDictionaries().
value - available dictionary readers for post processingpublic void setDoSpellingCorrection(boolean value)
Sets a value indicating whether automatic spelling correction should be applied. Use this option to improve OCR result but notice that this will increase total processing time
OcrEngine ocr = new OcrEngine(); ocr.setImage(ImageStream.fromFile("image.tiff")); ocr.getLanguages().addLanguage(Language.load("english")); ocr.getConfig().setDoSpellingCorrection(true); FileInputStream resourceStream = new FileInputStream(resourceFileName); ocr.setResource(resourceStream); if (ocr.process()) { System.out.println(ocr.getText()); }
value - a value indicating whether automatic spelling correction should be appliedpublic void setProbabilityRow(int value)
Sets row with probable symbols to return probable symbols from.
value - the row with probable symbolspublic void setProcessColoredBackground(boolean value)
Turn on this option if input image have complex colored background, and standard method of thresholding work bad
value - true if should process colored backgroundpublic void setQuantizationPalleteSize(int value)
It is advanced option, which control number of colors to image pallete while quantization; this option make sence olny if ProcessColoredBackground is true; defalt value if 5
value - the value for the quantization pallete sizepublic void setRemoveNonText(boolean value)
Set this parameter to TRUE if image contains non-text components (e.g. pictures, graphics) that should be detected and ignored during recognition process
OcrEngine ocr = new OcrEngine(); ocr.setImage(ImageStream.fromFile("image.tiff")); ocr.getLanguages().addLanguage(Language.load("english")); ocr.getConfig().setRemoveNonText(true); FileInputStream resourceStream = new FileInputStream(resourceFileName); ocr.setResource(resourceStream); if (ocr.process()) { System.out.println(ocr.getText()); }
value - public void setUseDefaultDictionaries(boolean value)
If getDictionaryReader() is null, this method specifies whether to use default dictionaries
value - true if use default dictionariesCopyright © 2014. All rights reserved.