private void populateMap() { foreach (int?row in linePositions) { map[row] = OCRUtilities.wordsPositions(image, row, letterInfo.LetterSize, letterInfo.SpaceGap); } }
public Text(BufferedImage image, Letter letterInformation) { this.letterInfo = letterInformation; this.image = image; linePositions = OCRUtilities.rowPositions(image, letterInformation.SmallestSizeLetter); createMap(); populateMap(); }
// public Letter(int scanQuality, int fontSize) { // this.scanQuality = scanQuality; // this.fontSize = fontSize; // // calculateDimensions(); // calculateSmallestSizeLetter(); // calculateLetterSize(); // calculateTrashsize(); // calculateSpaceGap(); // } public Letter(int scanQuality, BufferedImage image) { this.scanQuality = scanQuality; this.image = image; heightHistogram = Histogram.heightHistogram(image); gradient = Histogram.gradient(heightHistogram); calculateSmallestSizeLetter(); List <int?> rowHeights = OCRUtilities.rowHeights(gradient, smallestSizeLetter); int meanHeight = (int)caluclateMean(rowHeights); calculateDimensions(meanHeight); calculateLetterSize(meanHeight); calculateSpaceGap(meanHeight); }