我无法在黑色背景上提取文本,如所附图像所示。其他所有东西都被认可。
有人可以帮忙吗?
public static void main(String args[]) {
scrShotDirPath = new File("/Users/prakashp/IdeaProjects/screenshots");
String imgName = "15-Nov-2018_05_14_57PM.png";
String result = null;
File imageFile = new File(scrShotDirPath, imgName);
logger.info("Image name is :" + imageFile.toString());
ITesseract instance = new Tesseract();
File tessDataFolder = LoadLibs.extractTessResources("tessdata");
instance.setDatapath(tessDataFolder.getAbsolutePath());
try {
result = instance.doOCR(imageFile);
logger.info(result);
} catch (TesseractException e) {
logger.info("", e);
}
}
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>4.2.2</version>
</dependency>