Code Monkey home page Code Monkey logo

Comments (10)

mohuishou avatar mohuishou commented on July 24, 2024

有调用分割的API么,https://github.com/mohuishou/ImageOCR#%E5%88%86%E5%89%B2

from imageocr.

mohuishou avatar mohuishou commented on July 24, 2024

给出的代码不全没有办法判断具体的错误

from imageocr.

mkerj avatar mkerj commented on July 24, 2024
public function __construct($path)
{
    $image=new Image($path);
    $this->image_ocr=new ImageOCR($image);

    //开启的debug模式
    $this->image_ocr->setDebug(true);
    //初始化
    $this->image_ocr->setMaxGrey(90);
    $this->image_ocr->setMinGrey(25); // 130
    $this->image_ocr->setStandardWidth(65);
    $this->image_ocr->setStandardHeight(25);
}

public function standard()
{
    //避免重复调用
    if (!empty($this->standard_data)) {
        return $this->standard_data;
    }

    try {
        //第一步灰度化
        $this->image_ocr->grey();
        //第二步二值化
        $this->image_ocr->hashByBackground(ImageOCR::MAX_MODEL);
        //下一步会用到连通域分割法,先初始化
        $this->image_ocr->setImageConnect();
        //第三部除噪&第四步分割
        $this->image_ocr->splitByConnect();
        //第五步标准化
        return $this->image_ocr->standard();
    } catch (\Exception $e) {
        echo $e->getMessage();
    }
    return false;
}

所有代码用的是实例的 ,我只改了二值化和宽高。

from imageocr.

mohuishou avatar mohuishou commented on July 24, 2024

我直接运行修改docker容器中的参数, 和你一致之后还是ok的,没有复现你的这个问题, 你有修改其他地方么。

 public function __construct($path)
    {
        $image=new Image($path);
        $this->image_ocr=new ImageOCR($image);

        //开启的debug模式
        $this->image_ocr->setDebug(true);

        //初始化
        $this->image_ocr->setMaxGrey(90);
        $this->image_ocr->setMinGrey(25);
        $this->image_ocr->setStandardWidth(65);
        $this->image_ocr->setStandardHeight(25);
    }

from imageocr.

mkerj avatar mkerj commented on July 24, 2024

没有改其它的地方,我提供验证码给您,您方便测试一下:http://prw4hcq80.bkt.clouddn.com/1.png
这个地址 有 1-8个验证码。 http://prw4hcq80.bkt.clouddn.com/1...8.png

from imageocr.

mohuishou avatar mohuishou commented on July 24, 2024

晚上帮你看下,现在有点忙

from imageocr.

mkerj avatar mkerj commented on July 24, 2024

好的,谢谢!~

from imageocr.

mohuishou avatar mohuishou commented on July 24, 2024

我在index.php注释掉了生成图片的代码

// $captch->create();
$img_path=__DIR__."/img/1.png";
// $captch->save($img_path,1);

$img=new \Mohuishou\ImageOCR\Example\OCR($img_path);

重启之后也没有报错
image

from imageocr.

mkerj avatar mkerj commented on July 24, 2024

我测试的情况,当识别结果差不多正确的时候 就会报错,如果结果是错误的就能正常。

from imageocr.

mohuishou avatar mohuishou commented on July 24, 2024

那只能怀疑是参数问题,除噪分割之后标准化之后没有数据了,这个建议你打断点debug一下,或者每一步都都把结果打印一下

from imageocr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.