Package org.openpnp.util
Class OcrUtils
- java.lang.Object
-
- org.openpnp.util.OcrUtils
-
public class OcrUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBARCODE_PSEUDO_FONT
-
Constructor Summary
Constructors Constructor Description OcrUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.String>createFontSelectionList(java.lang.String selectedFont, boolean addEmpty)Compose a font list of the system.static java.lang.StringgetConsolidatedPartsAlphabet(java.util.function.Function<Part,java.lang.Boolean> partFilter, java.lang.String stockAlphabet)From all the optionally filtered parts in the system, create the alphabet for OCR operation.static PartidentifyDetectedPart(SimpleOcr.OcrModel detectedOcrModel, Feeder feeder)Identify an OCR detected part.
-
-
-
Field Detail
-
BARCODE_PSEUDO_FONT
public static final java.lang.String BARCODE_PSEUDO_FONT
- See Also:
- Constant Field Values
-
-
Method Detail
-
createFontSelectionList
public static java.util.List<java.lang.String> createFontSelectionList(java.lang.String selectedFont, boolean addEmpty)Compose a font list of the system. Always add the one currently selected, even if the system does not know it (yet), and optionally the empty selection.- Parameters:
selectedFont-addEmpty-- Returns:
-
getConsolidatedPartsAlphabet
public static java.lang.String getConsolidatedPartsAlphabet(java.util.function.Function<Part,java.lang.Boolean> partFilter, java.lang.String stockAlphabet)
From all the optionally filtered parts in the system, create the alphabet for OCR operation.- Parameters:
partFilter- optional part filtering Function.stockAlphabet- TODO- Returns:
-
identifyDetectedPart
public static Part identifyDetectedPart(SimpleOcr.OcrModel detectedOcrModel, Feeder feeder) throws java.lang.Exception
Identify an OCR detected part. This will automatically fuse line breaks, determine whether spaces are allowed and allow for partial matches in the typical form *-pattern (for redundant package prefixes etc.), but checking for ambiguity.- Parameters:
detectedOcrModel-feeder-- Returns:
- Throws:
java.lang.Exception
-
-