- java.lang.Object
-
- com.uddernetworks.newocr.train.OCROptions
-
public class OCROptions extends java.lang.Object
General options used by the OCR scanning and training.- Since:
- April 25, 2019
-
-
Constructor Summary
Constructors Constructor Description OCROptions()
-
Method Summary
Modifier and Type Method Description void
addRatioWeight(Letter letter, double weight)
Adds a custom width/height ratio for the givenLetter
.void
addRatioWeightFromRule(SimilarRule similarRule, double weight)
Adds a custom width/height ratio for allLetter
s matching the givenSimilarRule
.void
addRatioWeights(java.util.List<Letter> letters, double weight)
Adds a custom width/height ratio for the eachLetter
i nthe given list.void
addRatioWeightsFromRules(java.util.List<SimilarRule> similarRules, double weight)
Adds a custom width/height ratio for allLetter
s matching all the givenSimilarRule
s.ImageReadMethod
getImageReadMethod()
Gets the method that will be used to read the image for both training and scanning.double
getMaxPercentDiffToMerge()
Gets the value set bysetMaxPercentDiffToMerge(double)
double
getSizeRatioWeight()
Gets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.double
getSizeRatioWeight(Letter letter)
Gets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.java.util.Set<java.lang.Character>
getSpecialSpaces()
Gets the characters requiring custom trained spaces.void
setImageReadMethod(ImageReadMethod imageReadMethod)
Sets theImageReadMethod
used during training and scanning.OCROptions
setMaxPercentDiffToMerge(double maxPercentDiffToMerge)
Sets the maximum percentage difference a line must be in order to merge in the very first phase of training.OCROptions
setSizeRatioWeight(double sizeRatioWeight)
Sets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.OCROptions
setSpecialSpaces(char... specialSpaces)
Sets the characters requiring custom trained spaces.OCROptions
setSpecialSpaces(java.util.Set<java.lang.Character> specialSpaces)
Sets the characters requiring custom trained spaces.
-
-
-
Method Detail
-
getSpecialSpaces
public java.util.Set<java.lang.Character> getSpecialSpaces()
Gets the characters requiring custom trained spaces.- Returns:
- The characters requiring custom spacing
-
setSpecialSpaces
public OCROptions setSpecialSpaces(java.util.Set<java.lang.Character> specialSpaces)
Sets the characters requiring custom trained spaces.- Parameters:
specialSpaces
- The characters requiring separate training for their trailing spaces.- Returns:
- The current
OCROptions
object
-
setSpecialSpaces
public OCROptions setSpecialSpaces(char... specialSpaces)
Sets the characters requiring custom trained spaces.- Parameters:
specialSpaces
- The characters requiring separate training for their trailing spaces.- Returns:
- The current
OCROptions
object
-
getMaxPercentDiffToMerge
public double getMaxPercentDiffToMerge()
Gets the value set bysetMaxPercentDiffToMerge(double)
- Returns:
- The value set by
setMaxPercentDiffToMerge(double)
-
setMaxPercentDiffToMerge
public OCROptions setMaxPercentDiffToMerge(double maxPercentDiffToMerge)
Sets the maximum percentage difference a line must be in order to merge in the very first phase of training. This is primarily for when underscores are below a line, and will need to be X% smaller than the line to merge.This value is by default 0.5
- Parameters:
maxPercentDiffToMerge
- The percentage to set- Returns:
- The current
OCROptions
object
-
addRatioWeight
public void addRatioWeight(Letter letter, double weight)
Adds a custom width/height ratio for the givenLetter
.- Parameters:
letter
- TheLetter
to set the weight ofweight
- The weight to set
-
addRatioWeights
public void addRatioWeights(java.util.List<Letter> letters, double weight)
Adds a custom width/height ratio for the eachLetter
i nthe given list.- Parameters:
letters
- TheLetter
list to set the weight ofweight
- The weight to set
-
addRatioWeightFromRule
public void addRatioWeightFromRule(SimilarRule similarRule, double weight)
Adds a custom width/height ratio for allLetter
s matching the givenSimilarRule
.- Parameters:
similarRule
- TheSimilarRule
to match to lettersweight
- The weight to set
-
addRatioWeightsFromRules
public void addRatioWeightsFromRules(java.util.List<SimilarRule> similarRules, double weight)
Adds a custom width/height ratio for allLetter
s matching all the givenSimilarRule
s.- Parameters:
similarRules
- TheSimilarRule
list to match to lettersweight
- The weight to set
-
getSizeRatioWeight
public double getSizeRatioWeight()
Gets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.- Returns:
- The weight of the width/height ratio
-
getSizeRatioWeight
public double getSizeRatioWeight(Letter letter)
Gets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.- Parameters:
letter
- The letter to get the width/height ratio of- Returns:
- The weight of the width/height ratio
-
setSizeRatioWeight
public OCROptions setSizeRatioWeight(double sizeRatioWeight)
Sets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.- Parameters:
sizeRatioWeight
- The weight of the width/height ratio- Returns:
- The current
OCROptions
object
-
getImageReadMethod
public ImageReadMethod getImageReadMethod()
Gets the method that will be used to read the image for both training and scanning.- Returns:
- The
ImageReadMethod
used in training and scanning.
-
setImageReadMethod
public void setImageReadMethod(ImageReadMethod imageReadMethod)
Sets theImageReadMethod
used during training and scanning.- Parameters:
imageReadMethod
- TheImageReadMethod
to set
-
-