Tess4J-src


java 图像识别技术Tess4J -3.4.2版本相关Jar包和代码
资源截图
代码片段和文件信息
/**
 * JDeskew
 */
package com.recognition.software.jdeskew;

import java.awt.image.BufferedImage;

public class ImageDeskew {

    /**
     * Representation of a line in the image.
     */
    public class HoughLine {

        // count of points in the line
        public int count = 0;
        // index in matrix.
        public int index = 0;
        // the line is represented as all x y that solve y * cos(alpha) - x *
        // sin(alpha) = d
        public double alpha;
        public double d;
    }
    // the source image
    private BufferedImage cImage;
    // the range of angles to search for lines
    private double cAlphaStart = -20;
    private double cAlphaStep = 0.2;
    private int cSteps = 40 * 5;
    // pre-calculation of sin and cos
    private double[] cSinA;
    private double[] cCosA;
    // range of d
    private double cDMin;
    private double cDStep = 1.0;
    private int cDCount;
    // count of points that fit in a line
    private int[] cHMatrix;

    // constructor
    public ImageDeskew(BufferedImage image) {
        this.cImage = image;
    }

    // calculate the skew angle of the image cImage
    public double getSkewAngle() {
        ImageDeskew.HoughLine[] hl;
        double sum = 0.0;
        int count = 0;

        // perform Hough Transformation
        calc();
        // top 20 of the detected lines in the image
        hl = getTop(20);

        if (hl.length >= 20) {
            // average angle of the lines
            for (int i = 0; i < 19; i++) {
                sum += hl[i].alpha;
                count++;
            }
            return (sum / count);
        } else {
            return 0.0d;
        }
    }

    // calculate the count lines in the image with most points
    private ImageDeskew.HoughLine[] getTop(int count) {

        ImageDeskew.HoughLine[] hl = new ImageDeskew.HoughLine[count];
        for (int i = 0; i < count; i++) {
            hl[i] = new ImageDeskew.HoughLine();
        }

        ImageDeskew.HoughLine tmp;

        for (int i = 0; i < (this.cHMatrix.length - 1); i++) {
            if (this.cHMatrix[i] > hl[count - 1].count) {
                hl[count - 1].count = this.cHMatrix[i];
                hl[count - 1].index = i;
                int j = count - 1;
                while ((j > 0) && (hl[j].count > hl[j - 1].count)) {
                    tmp = hl[j];
                    hl[j] = hl[j - 1];
                    hl[j - 1] = tmp;
                    j--;
                }
            }
        }

        int alphaIndex;
        int dIndex;
        
        for (int i = 0; i < count; i++) {
            dIndex = hl[i].index / cSteps; // integer division no
            // remainder
            alphaIndex = hl[i].index - dIndex * cSteps;
            hl[i].alpha = getAlpha(alphaIndex);
            hl[i].d = dIndex + cDMin;
        }

        re

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5447  2017-11-14 21:09  3.4.2111相关Jar包和代码1Tess4Juild.xml

     文件       1328  2017-11-14 21:20  3.4.2111相关Jar包和代码1Tess4JdistREADME.TXT

     文件   40532498  2017-11-14 21:20  3.4.2111相关Jar包和代码1Tess4Jdist ess4j-3.4.2.jar

     文件     233857  2015-12-06 21:56  3.4.2111相关Jar包和代码1Tess4Jlibcommons-beanutils-1.9.2.jar

     文件     214788  2017-10-31 10:45  3.4.2111相关Jar包和代码1Tess4Jlibcommons-io-2.6.jar

     文件      61829  2015-12-06 21:56  3.4.2111相关Jar包和代码1Tess4Jlibcommons-logging-1.2.jar

     文件     180370  2016-03-21 16:47  3.4.2111相关Jar包和代码1Tess4Jlibghost4j-1.0.1.jar

     文件      45280  2015-11-13 17:02  3.4.2111相关Jar包和代码1Tess4Jlibhamcrest-core-1.3.jar

     文件    1130070  2014-11-20 05:54  3.4.2111相关Jar包和代码1Tess4Jlibitext-2.1.7.jar

     文件     602022  2016-03-03 16:55  3.4.2111相关Jar包和代码1Tess4Jlibjai-imageio-core-1.3.1.jar

     文件     144240  2017-05-29 11:51  3.4.2111相关Jar包和代码1Tess4Jlibjboss-vfs-3.2.12.Final.jar

     文件      16515  2017-03-21 19:29  3.4.2111相关Jar包和代码1Tess4Jlibjcl-over-slf4j-1.7.25.jar

     文件     914597  2016-05-16 18:18  3.4.2111相关Jar包和代码1Tess4Jlibjna-4.1.0.jar

     文件       4596  2017-03-21 19:29  3.4.2111相关Jar包和代码1Tess4Jlibjul-to-slf4j-1.7.25.jar

     文件     316791  2015-11-13 17:02  3.4.2111相关Jar包和代码1Tess4Jlibjunit-4.12.jar

     文件    7038364  2017-10-31 11:46  3.4.2111相关Jar包和代码1Tess4Jliblept4j-1.6.2.jar

     文件     489883  2014-11-20 05:54  3.4.2111相关Jar包和代码1Tess4Jliblog4j-1.2.17.jar

     文件      23645  2017-03-21 19:29  3.4.2111相关Jar包和代码1Tess4Jliblog4j-over-slf4j-1.7.25.jar

     文件     290339  2017-06-01 18:16  3.4.2111相关Jar包和代码1Tess4Jliblogback-classic-1.2.3.jar

     文件     471901  2017-06-01 18:16  3.4.2111相关Jar包和代码1Tess4Jliblogback-core-1.2.3.jar

     文件        421  2015-11-13 17:02  3.4.2111相关Jar包和代码1Tess4Jlib
blibraries.properties

     文件        595  2014-11-20 05:54  3.4.2111相关Jar包和代码1Tess4Jlibpdfpagecount.ps

     文件      41203  2017-03-21 19:29  3.4.2111相关Jar包和代码1Tess4Jlibslf4j-api-1.7.25.jar

     文件   16789504  2017-10-04 10:24  3.4.2111相关Jar包和代码1Tess4Jlibwin32-x86gsdll32.dll

     文件    2224128  2017-10-12 08:02  3.4.2111相关Jar包和代码1Tess4Jlibwin32-x86libtesseract3051.dll

     文件   18541568  2017-10-04 10:22  3.4.2111相关Jar包和代码1Tess4Jlibwin32-x86-64gsdll64.dll

     文件    2860032  2017-10-12 08:02  3.4.2111相关Jar包和代码1Tess4Jlibwin32-x86-64libtesseract3051.dll

     文件     601866  2014-11-20 05:54  3.4.2111相关Jar包和代码1Tess4Jlibxmlgraphics-commons-1.5.jar

     文件      81334  2017-10-12 08:00  3.4.2111相关Jar包和代码1Tess4J
bprojectuild-impl.xml

     文件        475  2017-10-12 08:00  3.4.2111相关Jar包和代码1Tess4J
bprojectgenfiles.properties

............此处省略79个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)