Skip to content

Commit 630cc6e

Browse files
committed
Refactor image height usages to improve the performance in .NET
DEVSIX-9803
1 parent 9c8557f commit 630cc6e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pdfocr-onnx-abstract/src/main/java/com/itextpdf/pdfocr/onnx/OnnxProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ Map<Integer, List<TextInfo>> doOcr(List<BufferedImage> images, OcrProcessContext
8282
}
8383
List<String> textString = toList(recognitionPredictor.predict(textImages));
8484
List<TextInfo> textInfos = new ArrayList<>(textBoxes.size());
85+
int imageHeight = image.getHeight();
8586
for (int i = 0; i < textBoxes.size(); ++i) {
8687
TextOrientation textOrientation = TextOrientation.HORIZONTAL;
8788
if (textOrientations != null) {
8889
textOrientation = textOrientations.get(i);
8990
}
9091
Point[] textPoints = getTextPoints(textBoxes.get(i), textOrientation);
91-
textInfos.add(new TextInfo().setText(textString.get(i))
92-
.setPixelTextPoints(textPoints, image.getHeight()));
92+
textInfos.add(new TextInfo().setText(textString.get(i)).setPixelTextPoints(textPoints, imageHeight));
9393
}
9494
result.put(imageIndex + 1, textInfos);
9595
++imageIndex;

0 commit comments

Comments
 (0)