0

I am trying to create an app that use the Vision SDK to track a face in real time, using the camera.

So far, it's only working when I hold the iPad in landscape right mode.

The process is the following:

// This  is the AVCaptureVideoDataOutputSampleBufferDelegate
    func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
        if let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) {
            sequenceHandler.perform(requests, on: imageBuffer)
        }
    }

Is there a way to rotate the stream easily, or hint the Vision SDK the correct orientation ?

Antzi
  • 12,831
  • 7
  • 48
  • 74

1 Answers1

0

It's actually super easy:

 open func perform(_ requests: [VNRequest], on image: CGImage, orientation: Int32) throws

Use the orientation parameter (not sure how I didn't saw it earlier.)

Antzi
  • 12,831
  • 7
  • 48
  • 74