Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CIDetector在iOS中未检测到正确的矩形?_Ios_Swift_Object Detection_Cidetector - Fatal编程技术网

CIDetector在iOS中未检测到正确的矩形?

CIDetector在iOS中未检测到正确的矩形?,ios,swift,object-detection,cidetector,Ios,Swift,Object Detection,Cidetector,我正在尝试使用CIDetector检测矩形 我使用的代码如下: 我的问题是,当我试图检测任何矩形对象时,有时它在检测,有时它在检测奇数矩形(请参见下图)。我试图在谷歌上搜索,但没有找到任何解决办法 正常情况: 一些坏情况: 下面是我设置CIDetector精度的代码: func highAccuracyRectangleDetector() -> CIDetector? { var detector: CIDetector? = nil detector = CIDete

我正在尝试使用
CIDetector
检测
矩形

我使用的代码如下:

我的问题是,当我试图检测任何
矩形
对象时,有时它在检测,有时它在检测
奇数矩形
(请参见下图)。我试图在谷歌上搜索,但没有找到任何解决办法

正常情况:

一些坏情况:

下面是我设置
CIDetector精度的代码

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

   return detector
}
若你们看第三幅图像,它会高亮显示,而不带
矩形
对象


当有适当的
矩形时,是否可以检测或显示高亮显示的绿色覆盖?请推荐我。

最后,我通过WetTransfer获得了一个开源库
WeScan
,用于检测矩形/文档扫描,并给出了准确的结果。我点击了以下链接:


有人对此进行了研究?可能有助于使用Vision框架和
VNDetectRectanglesRequest
。核心图像的这一部分表示,如果您使用的是iOS 11或更高版本,则视觉效果更好。我尝试使用视觉框架,但其闪烁过多,并且检测到的情况也很奇怪。