Tag: 加速 框架

使用vImageHistogramCalculation计算图像的直方图

我想使用vImage的vImageHistogramCalculation_ARGBFFFF来计算图像的直方图,但我得到一个types为kvImageNullPointerArgument (错误代码-21772)的vImage_Error。 这是我的代码: – (void)histogramForImage:(UIImage *)image { //setup inBuffer vImage_Buffer inBuffer; //Get CGImage from UIImage CGImageRef img = image.CGImage; //create vImage_Buffer with data from CGImageRef CGDataProviderRef inProvider = CGImageGetDataProvider(img); CFDataRef inBitmapData = CGDataProviderCopyData(inProvider); //The next three lines set up the inBuffer object inBuffer.width = CGImageGetWidth(img); inBuffer.height = CGImageGetHeight(img); inBuffer.rowBytes = CGImageGetBytesPerRow(img); //This sets the pointer […]