【发布时间】:2018-04-03 11:31:03
【问题描述】:
我正在尝试在 swift4 中使用 detectLandmarks,但在 let faceBoundingBox = boundingBox.scaled(to: self.view.bounds.size) 出现错误
任何人都知道如何解决它
func detectLandmarks(on image: CIImage) {
try? faceLandmarksDetectionRequest.perform([faceLandmarks], on: image)
if let landmarksResults = faceLandmarks.results as? [VNFaceObservation] {
for observation in landmarksResults {
DispatchQueue.main.async {
if let boundingBox = self.faceLandmarks.inputFaceObservations?.first?.boundingBox {
let faceBoundingBox = boundingBox.scaled(to: self.view.bounds.size)
//different types of landmarks
let faceContour = observation.landmarks?.faceContour
self.convertPointsForFace(faceContour, faceBoundingBox)
}
}
}
}
}
【问题讨论】:
-
你说有一个错误......但是,你没有告诉我们这个错误是什么。 (将错误放入问题中)。 :D
-
CGRect 确实没有
scaled成员。也许它来自一个框架。