I am developing an application in Swift language. I provide video calling using Agora SDK. There is only one camera in the app. The user's local camera. It covers the entire screen. The camera is not AVFoundition. Agora's camera feature. It comes with agoraEngine.enableVideo() and agoraEngine.startPreview. So I set my camera from Agora. I'm getting all the pixels of the camera using the function below. But what I really want is to get the pixels in an imaginary ellipse (like a face shape) in the middle of the screen with the size of 300x400. In other words, taking only the pixels in this ellipse from all the pixels and only getting the pixels when a face enters that ellipse. How do I provide this?
extension ViewController: AgoraVideoFrameDelegate{
func onCapture(_ videoFrame: AgoraOutputVideoFrame) -> Bool {
guard let pixelBuffer = videoFrame.pixelBuffer else { return false }
print(pixelBuffer)
return true
}
}
I tried parsing to pixels using UIImage but I couldn't get the pixels