小编LLL*_*RRR的帖子

如何在TrainingImageLoader中使用png加载前100个字符

我想在前100个字符中绘制最好的png文件,但如果他们不能完成所有这一切.

文件在那里:http://abatis.org.uk/projects/txt2fig.png

            File fff = new File("C:\\Users\\lll\\Desktop\\txt2fig.png");
            OCRScanner scanner = new OCRScanner();
            TrainingImageLoader loader = new TrainingImageLoader();
            HashMap<Character, ArrayList<TrainingImage>> trainingImageMap = new HashMap<Character, ArrayList<TrainingImage>>();
            loader.load(fff.getAbsolutePath(), new CharacterRange('A', 'Z'), trainingImageMap);
            scanner.addTrainingImages(trainingImageMap);

            Image image = ImageIO.read(fff);
            PixelImage pixelImage = new PixelImage(image);
            pixelImage.toGrayScale(true);
            pixelImage.filter();

            String text = scanner.scan(image, 0, 0, 0, 0, null);
            System.out.println(text);
Run Code Online (Sandbox Code Playgroud)

例外:

java.io.IOException: Expected to decode 26 characters but actually decoded 911 characters in training: C:\Users\lll\Desktop\txt2fig.png
    at net.sourceforge.javaocr.ocrPlugins.mseOCR.TrainingImageLoader.load(TrainingImageLoader.java:107)
    at net.sourceforge.javaocr.ocrPlugins.mseOCR.TrainingImageLoader.load(TrainingImageLoader.java:83)
Run Code Online (Sandbox Code Playgroud)

我在pom的图书馆:

        <dependency>
            <groupId>net.sourceforge.javaocr</groupId>
            <artifactId>javaocr-core</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency> …
Run Code Online (Sandbox Code Playgroud)

java ocr

5
推荐指数
1
解决办法
510
查看次数

标签 统计

java ×1

ocr ×1