CIDetector not detecting proper Rectangle in iOS?

余生长醉 提交于 2019-11-28 11:31:29

问题


I am trying to detect a Rectangle using CIDetector.

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

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:

Here is my code to set the 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
}

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

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


回答1:


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



来源:https://stackoverflow.com/questions/54399074/cidetector-not-detecting-proper-rectangle-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!