I’ve a videoPreviewLayer that takes up all the display.
The AVCaptureSession() has an AVCaptureVideoDataOutput() that information video and offers entry to video frames for processing and a AVCapturePhotoOutput() that offers a seize output for nonetheless picture, Stay Pictures, and different pictures workflows.
The func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photograph: AVCapturePhoto, error: Error?) offers a picture upon seize which is straightforward to work with.
However the func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) returns frames of sampleBuffer kind that I have to crop from the middle as a sq.. And I want this output in CVImageBuffer format(enter to a CoreML mannequin)
Mainly I want heart cropped sampleBuffer frames to work with whereas displaying the videoPreviewLayer that takes up all the display.
I attempted helper capabilities to crop CVImageBuffer however don’t have any means of confirming if its certainly heart cropped.