3

我需要做的是制作一个扫描仪来扫描文件。目前我正在使用CIDetector类型检测任何矩形CIDetectorTypeRectangle

func detectRectangleInScanner() -> CIDetector {

    let options: [String: AnyObject] = [CIDetectorAccuracy: CIDetectorAccuracyHigh]
    return CIDetector(ofType: CIDetectorTypeRectangle, context: nil, options: options)

}

它工作正常并检测带有边缘的矩形。

现在我已经制作了一个带有四个角的扫描仪视图覆盖,这样如果文档位于这些覆盖框架内,那么只有扫描仪会检测到该文档。视频链接

AVCaptureMetadataOutput有一个rectOfInterest做同样事情的属性,但不幸的是它不能用于文档扫描。

4

0 回答 0