ios - CIDetector 在 iOS 中没有检测到正确的矩形?

标签 ios swift object-detection cidetector

我正在尝试使用 CIDetector 检测 Rectangle

我使用的代码来自:https://www.cocoacontrols.com/controls/vnimagescanner

我的问题是,当我尝试检测任何 Rectangle 对象时,它有时会检测到或有时会检测到 Odd Rectangle(请参见下图)。我试图搜索这个谷歌但没有找到任何解决方案。

Normal case:

enter image description here

enter image description here

Some bad case:

enter image description here

这是我设置 CIDetector 精度 的代码:

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

   return detector
}

如果您查看第三张图片,它会在没有 Rectangle 对象的情况下突出显示。

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

最佳答案

最后我得到了 WeTransfer 的开源库 WeScan 来检测矩形/文档扫描,这给出了准确的结果。我点击了以下链接:

https://github.com/WeTransfer/WeScan

关于ios - CIDetector 在 iOS 中没有检测到正确的矩形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54399074/

相关文章:

ios - 文本在 UITextField 中不正确可见

ios - Swift:将音频添加到 AVMutableComposition

c++ - OpenCV:如何使用 Haar Classifier Cascade 提高眼睛检测的准确性?

ios - 从 UICollection 中删除项目但出现 "Array index out of range"错误

ios - 如何识别以前安装在 iOS 设备中的应用程序?

ios - UICollectionView 单元可重用性问题 - swift

python - Tensorflow Lite - ValueError : Cannot set tensor: Dimension mismatch

ios - minimumInteritemSpacing 在 Collection View 的末尾添加了一些奇怪的内容

macos - Cocoa Storyboard 响应链

machine-learning - 使用 Dlib 库进行对象检测