0
我試圖從給定圖像中檢測對象。從研究我發現,我們能夠發現並使用以下過程跟蹤視頻的對象:使用視覺框架從圖像中進行對象檢測
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)
}
我們能有像metadataOutputRectConverted
爲ImageView的類似的方法?我試圖在用戶點擊該對象時檢測對象矩形。這如何實現?
詳細說明你的答案,添加一些代碼來演示它。 – Satendra