Manipulate CVPixelbuffer, vImage, CGImage and UIImage for a rotation

454 views Asked by At

I get from AR session, the current frame with: self.sceneView.session.currentFrame?.capturedImage so I get a CVPixelBuffer with my image information.

I followed this link to convert my CVPixelBuffer to CGImage. (I use previously createCGImage method but this method create a memory leak in my app.)

But I have an issue now, the CGImage received at the end is on the landscape mode and not portrait (my app allows only portrait mode) like you can see on the image below.

UIImage generated from CGImage

So I'm trying to fix this rotation. I saw vImageRotate90_ARGB8888(_:_:_:_:_:) exist but I have trouble to use it because my pointer for the backColor is always nil.

Do you have any method to rotate it without a memory leak because I have to rotate it couple times per seconde?

Thanks

0

There are 0 answers