How to scale/resize CVPixelBufferRef in objective C, iOS
Clash Royale CLAN TAG #URR8PPP How to scale/resize CVPixelBufferRef in objective C, iOS I am trying to resize an image from a CVPixelBufferRef to 299x299. Ideally is would also crop the image. The original pixelbuffer is 640x320, the goal is to scale/crop to 299x299 without loosing aspect ratio (crop to center). I found code to resize a UIImage in objective c, but none to resize a CVPixelBufferRef. I have found various very complicated examples of object C many different image types, but none specifically for resizing a CVPixelBufferRef. What is the easiest/best way to do this, please include the exact code. ... I tried the answer from selton, but this did not work as the resulting type in the scaled buffer is not correct (goes into assert code), OSType sourcePixelFormat = CVPixelBufferGetPixelFormatType(pixelBuffer); int doReverseChannels; if (kCVPixelFormatType_32ARGB == sourcePixelFormat) { doReverseChannels = 1; } else if (kCVPixelFormatType_32BGRA == sourcePixelFormat) {...
I've currently checked in the console and it shows the following:
exception nativeEvalAndFetch : ReferenceError: Can't find variable: cordovaglobal code about:blank 1:127 global code script element 1:1:127try { cordova.require('cordova/exec').nativeEvalAndFetch(function() { cordova.fireDocumentEvent('active'); }) } catch (e) { console.log('exception nativeEvalAndFetch : ' + e); };Looking for this code in xcode I find that it is in CDVCommandDelegateImpl.m but I could not solve it yet– Alex
May 23 at 22:02