【问题标题】:Object detection from image using vision framework使用视觉框架从图像中检测目标
【发布时间】:2018-02-27 19:19:01
【问题描述】:

我正在尝试从给定图像中检测对象。通过研究,我发现我们可以使用以下过程检测和跟踪视频的对象:

private lazy var cameraLayer: AVCaptureVideoPreviewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession)

private func tapGestureAction(recognizer: UITapGestureRecognizer) 
 {
   highlightView.frame.size = CGSize(width: 200, height: 200)
   highlightView.center = recognizer.location(in: view)

   let originalRect = highlightView.frame
   var convertedRect = cameraLayer.metadataOutputRectConverted(fromLayerRect: originalRect)
   convertedRect.origin.y = 1 - convertedRect.origin.y

   previousObservation = VNDetectedObjectObservation(boundingBox: convertedRect)
 }

我们可以为 imageView 提供类似metadataOutputRectConverted 的方法吗?每当用户点击该对象时,我都会尝试检测对象 rect。这如何实现?

【问题讨论】:

    标签: objective-c ios11 object-detection coreml apple-vision


    【解决方案1】:

    此方法将相机输出矩形(topleft(0,0) 到 bottomright(0,1))转换为 UI 矩形。所以,我认为你不需要转换它

    【讨论】:

    • 阐述你的答案,添加一些代码来演示它。
    猜你喜欢
    • 1970-01-01
    • 2019-06-08
    • 2018-12-01
    • 2019-01-19
    • 2017-12-03
    • 2017-12-09
    • 1970-01-01
    • 2019-12-18
    • 2022-08-04
    相关资源
    最近更新 更多