CIDetector无法在iOS中检测到正确的Rectangle吗? [英] CIDetector not detecting proper Rectangle in iOS?

查看:229
本文介绍了CIDetector无法在iOS中检测到正确的Rectangle吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CIDetector检测到Rectangle.

I am trying to detect a Rectangle using CIDetector.

我正在使用以下代码: https://www.cocoacontrols.com/controls/vnimagescanner

I am using code from this: https://www.cocoacontrols.com/controls/vnimagescanner

我的问题是,当我尝试检测任何Rectangle对象时,有时它正在检测或有时它正在检测Odd Rectangle(请参见下图).我试图搜索此Google,但没有找到任何解决方案.

My problem is when I am trying to detect any Rectangle object, sometimes it's detecting or sometimes it's detecting Odd Rectangle (please see below images). I tried to search this Google but didn't find any solution of this.

正常情况:

Normal case:

一些不好的情况:

Some bad case:

这是我设置CIDetector Accuracy的代码:

func highAccuracyRectangleDetector() -> CIDetector? {
   var detector: CIDetector? = nil
   detector = CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh, CIDetectorAspectRatio: 1.43, CIDetectorMaxFeatureCount: 5])

   return detector
}

如果您要看第三张图像,它会突出显示而没有Rectangle对象.

If you will look into third image, it's highlighting without Rectangle object.

当有适当的Rectangle时,是否可以检测或显示突出显示的绿色覆盖物?请建议我.

Is it possible to detect or to display the highlighted green overlay when there will be a proper Rectangle? Please suggest me.

推荐答案

最后,我得到了WeTransfer的开源库WeScan来检测Rectangle/Document扫描,从而得出了准确的结果.我点击了以下链接:

Finally I got the an Open source library WeScan by WeTransfer to detect Rectangle/Document scanning and this give accurate result. I followed below link:

https://github.com/WeTransfer/WeScan

这篇关于CIDetector无法在iOS中检测到正确的Rectangle吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆