Hey @brandonK212
Did you figure out a solution to this?
Im trying to do something similar and running into similar problem.
As a debugging step, I tried to draw detected rectangle on RealityKit's ARView.
When drawing the detected rectangle as a sublayer of ARView, it seems to move away from the actual face as I slightly turn the device or my head(almost as if, responding to pitch, roll, yaw of the device/face)
But the overall dimensions of the rectangle(especially the height of the rectangle) seems to cover the entire face as expected
Im using displayTransform from ARView to adjust the boundingbox
here's some code outlining the steps I'm doing:
let viewPortRect = self.arView.frame
let toArViewScaleTx = CGAffineTransform(scaleX: viewPortRect.size.width, y: viewPortRect.size.height)
self.displayTransform = frame.displayTransform(for: interfaceOrientation,
viewportSize: self.viewPortRect.size).concatenating(toArViewScaleTx)
//...
//drawObservations
guard let faceRes = self.facePoseRequest.results?.first as? VNFaceObservation else {
return
}
let arDisplayRect = faceRes.boundingBox.applying(self.displayTransform)
//Draw rect
let path = UIBezierPath(rect: arDisplayRect)
self.bbLayer.path = path.cgPath // self.bbLayer is created and added as a sublayer of arView.layer in viewDidLoad
self.bbLayer.strokeColor = color.cgColor
Topic:
Graphics & Games
SubTopic:
SceneKit
Tags: