2

I am using a

VNDetectFaceLandmarksRequest

combined with a

VNSequenceRequestHandler

to process images coming from the

AVCaptureVideoDataOutput

delegate call:

func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection)

I want to be able to show the face landmarks in realtime, so that the user can see them overlaid over the AVCaptureVideoPreviewLayer.

So, as the AVCaptureVideoDataOutput delegate gets called, I then call:

func perform(_ requests: [VNRequest], on image: CIImage)

The CIImage comes from the CMSampleBuffer the delegate provides.

The problem is that the landmarks lag. As I move my face in front of the camera the landmarks are quite slow to update.

How can I update the landmarks so that they follow the face movement without lagging behind?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
zumzum
  • 17,984
  • 26
  • 111
  • 172
  • 1
    It takes some time to find the landmarks so that's why you have the lags. I know that you can use face tracking and I believe this is what you should use to track the face rather than search for the face with every single frame. – Greg Oct 09 '17 at 16:29

0 Answers0