- java.lang.Object
-
- com.uddernetworks.newocr.train.OCROptions
-
public class OCROptions extends java.lang.ObjectGeneral 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 voidaddRatioWeight(Letter letter, double weight)Adds a custom width/height ratio for the givenLetter.voidaddRatioWeightFromRule(SimilarRule similarRule, double weight)Adds a custom width/height ratio for allLetters matching the givenSimilarRule.voidaddRatioWeights(java.util.List<Letter> letters, double weight)Adds a custom width/height ratio for the eachLetteri nthe given list.voidaddRatioWeightsFromRules(java.util.List<SimilarRule> similarRules, double weight)Adds a custom width/height ratio for allLetters matching all the givenSimilarRules.ImageReadMethodgetImageReadMethod()Gets the method that will be used to read the image for both training and scanning.doublegetMaxPercentDiffToMerge()Gets the value set bysetMaxPercentDiffToMerge(double)doublegetSizeRatioWeight()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.doublegetSizeRatioWeight(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.voidsetImageReadMethod(ImageReadMethod imageReadMethod)Sets theImageReadMethodused during training and scanning.OCROptionssetMaxPercentDiffToMerge(double maxPercentDiffToMerge)Sets the maximum percentage difference a line must be in order to merge in the very first phase of training.OCROptionssetSizeRatioWeight(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.OCROptionssetSpecialSpaces(char... specialSpaces)Sets the characters requiring custom trained spaces.OCROptionssetSpecialSpaces(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
OCROptionsobject
-
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
OCROptionsobject
-
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
OCROptionsobject
-
addRatioWeight
public void addRatioWeight(Letter letter, double weight)
Adds a custom width/height ratio for the givenLetter.- Parameters:
letter- TheLetterto 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 eachLetteri nthe given list.- Parameters:
letters- TheLetterlist to set the weight ofweight- The weight to set
-
addRatioWeightFromRule
public void addRatioWeightFromRule(SimilarRule similarRule, double weight)
Adds a custom width/height ratio for allLetters matching the givenSimilarRule.- Parameters:
similarRule- TheSimilarRuleto 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 allLetters matching all the givenSimilarRules.- Parameters:
similarRules- TheSimilarRulelist 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
OCROptionsobject
-
getImageReadMethod
public ImageReadMethod getImageReadMethod()
Gets the method that will be used to read the image for both training and scanning.- Returns:
- The
ImageReadMethodused in training and scanning.
-
setImageReadMethod
public void setImageReadMethod(ImageReadMethod imageReadMethod)
Sets theImageReadMethodused during training and scanning.- Parameters:
imageReadMethod- TheImageReadMethodto set
-
-