Package org.sikuli.script
Class OCR
java.lang.Object
org.sikuli.script.OCR
public class OCR extends Object
Static helper class for OCR via Tess4J/Tesseract.
The methods in this class are not threadsafe.
- See Also:
- SikuliX docs: Text and OCR
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected static intPAGE_ITERATOR_LEVEL_LINEINTERNAL: Tesseract option.protected static intPAGE_ITERATOR_LEVEL_WORDINTERNAL: Tesseract option. -
Constructor Summary
Constructors Constructor Description OCR() -
Method Summary
Modifier and Type Method Description static OCR.OptionsglobalOptions()access/get the current global Options (Singleton).static <SFIRBS> StringreadChar(SFIRBS from)Reads text from the given source (character).static <SFIRBS> StringreadChar(SFIRBS from, OCR.Options options)Reads text from the given source (character).static <SFIRBS> StringreadLine(SFIRBS from)Reads text from the given source (line).static <SFIRBS> StringreadLine(SFIRBS from, OCR.Options options)Reads text from the given source (line).static <SFIRBS> List<Match>readLines(SFIRBS from)Reads text from the given source as lines.static <SFIRBS> List<Match>readLines(SFIRBS from, OCR.Options options)Reads text from the given source as lines.static <SFIRBS> StringreadText(SFIRBS from)Reads text from the given source.static <SFIRBS> StringreadText(SFIRBS from, OCR.Options options)Reads text from the given source.static <SFIRBS> StringreadWord(SFIRBS from)Reads text from the given source (word).static <SFIRBS> StringreadWord(SFIRBS from, OCR.Options options)Reads text from the given source (word).static <SFIRBS> List<Match>readWords(SFIRBS from)Reads text from the given source as words.static <SFIRBS> List<Match>readWords(SFIRBS from, OCR.Options options)Reads text from the given source as words.static OCR.Optionsreset()Resets the global options to the initial defaults.static voidstatus()prints out the current global options.
-
Field Details
-
PAGE_ITERATOR_LEVEL_WORD
protected static final int PAGE_ITERATOR_LEVEL_WORDINTERNAL: Tesseract option.- See Also:
- Constant Field Values
-
PAGE_ITERATOR_LEVEL_LINE
protected static final int PAGE_ITERATOR_LEVEL_LINEINTERNAL: Tesseract option.- See Also:
- Constant Field Values
-
-
Constructor Details
-
OCR
public OCR()
-
-
Method Details
-
globalOptions
access/get the current global Options (Singleton).- Returns:
- the global Options
-
reset
Resets the global options to the initial defaults.- Returns:
- the global Options
- See Also:
OCR.Options.reset()
-
status
public static void status()prints out the current global options. -
readText
Reads text from the given source.Uses the global options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text from- Returns:
- text
-
readText
Reads text from the given source.Uses the given options
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text fromoptions- Options to be used- Returns:
- text
-
readLine
Reads text from the given source (line).assuming the source contains a single line of text.
Uses the global options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text from- Returns:
- text
-
readLine
Reads text from the given source (line).assuming the source contains a single line of text.
Uses the given options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text fromoptions- options for the used TextRecognizer- Returns:
- text
-
readLines
Reads text from the given source as lines.Uses the global options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text from- Returns:
- lines as a list of matches
-
readLines
Reads text from the given source as lines.Uses the given options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text fromoptions- options for the used TextRecognizer- Returns:
- lines
-
readWord
Reads text from the given source (word).assuming the source contains a single word of text.
Uses the global options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text from- Returns:
- text
-
readWord
Reads text from the given source (word).assuming the source contains a single word of text.
Uses the given options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text fromoptions- options for the used TextRecognizer- Returns:
- text
-
readWords
Reads text from the given source as words.Uses the global options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text from- Returns:
- words as alist of matches
-
readWords
Reads text from the given source as words.Uses the given options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text fromoptions- options for the used TextRecognizer- Returns:
- words as a list of matches
-
readChar
Reads text from the given source (character).assuming the source contains a single character.
Uses the global options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text from- Returns:
- text
-
readChar
Reads text from the given source (character).assuming the source contains a single character.
Uses the given options.
- Type Parameters:
SFIRBS- File name, File, Image, Region, BufferdImage or ScreenImage- Parameters:
from- source to read text fromoptions- options for the used TextRecognizer- Returns:
- text
-