vimage

“fatal error: unexpectedly found nil while unwrapping an Optional value” while using vImageBuffer_initWithCGImage in Swift ios

十年热恋 提交于 2020-01-04 09:19:51
问题 I'm working in Swift iOS8 and trying to convert UIImage to vImage_Buffer to perform manipulations using Accelerate.framework. I'm trying to use vImageBuffer_initWithCGImage for conversion, here is the code that I tried: func initvImageBufferwithUIImage (image:UIImage)-> vImage_Buffer{ var CGImg:CGImageRef = sunset.CGImage var inProvider:CGDataProviderRef = CGImageGetDataProvider(CGImg) var inBitmapData:CFDataRef = CGDataProviderCopyData(inProvider) var buffer:vImage_Buffer! var format:vImage

Does anyone have example code for vImage processing on iOS?

你离开我真会死。 提交于 2019-12-13 02:15:32
问题 I have read through every bit of documentation out there that I can find, but cannot get a simple vImage call to work. I just need a real example. Documentation is very sparse. 回答1: Documentation does not exist because the vImage libraries are not available on iOS. vImage is available on iOS since 5.0. The documentation is here. 回答2: If you're processing video in real-time, and your input is processed in a pixel buffer, here's how to copy that buffer into a vImage, at which point you can call

UIImageEffects: white image when Gaussian radius above 280, vImageBoxConvolve_ARGB8888 issue?

五迷三道 提交于 2019-12-11 21:22:31
问题 I'm using the Gaussian blur algorithm found in Apple's UIImageEffects example: CGFloat inputRadius = blurRadius * inputImageScale; if (inputRadius - 2. < __FLT_EPSILON__) inputRadius = 2.; uint32_t radius = floor((inputRadius * 3. * sqrt(2 * M_PI) / 4 + 0.5) / 2); radius |= 1; // force radius to be odd so that the three box-blur methodology works. NSInteger tempBufferSize = vImageBoxConvolve_ARGB8888(inputBuffer, outputBuffer, NULL, 0, 0, radius, radius, NULL, kvImageGetTempBufferSize |

How-to convert an iOS camera image to greyscale using the Accelerate Framework?

守給你的承諾、 提交于 2019-12-07 01:58:29
问题 It seems like this should be simpler than I'm finding it to be. I have an AVFoundation frame coming back in the standard delegate method: - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection where I would like to convert the frame to greyscale using the Accelerate.Framework . There is a family of conversion methods in the framework, including vImageConvert_RGBA8888toPlanar8() , which looks

How-to convert an iOS camera image to greyscale using the Accelerate Framework?

空扰寡人 提交于 2019-12-05 06:10:52
It seems like this should be simpler than I'm finding it to be. I have an AVFoundation frame coming back in the standard delegate method: - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection where I would like to convert the frame to greyscale using the Accelerate.Framework . There is a family of conversion methods in the framework, including vImageConvert_RGBA8888toPlanar8() , which looks like it might be what I would like to see, however, I can't find any examples of how to use them! So

iOS Accelerate Framework vImage - Performance improvement?

孤人 提交于 2019-12-04 13:36:27
问题 I've been working with OpenCV and Apple's Accelerate framework and find the performance of Accelerate to be slow and Apple's documentation limited. Let's take for example: void equalizeHistogram(const cv::Mat &planar8Image, cv::Mat &equalizedImage) { cv::Size size = planar8Image.size(); vImage_Buffer planarImageBuffer = { .width = static_cast<vImagePixelCount>(size.width), .height = static_cast<vImagePixelCount>(size.height), .rowBytes = planar8Image.step, .data = planar8Image.data }; vImage

iOS Accelerate Framework vImage - Performance improvement?

て烟熏妆下的殇ゞ 提交于 2019-12-03 08:25:06
I've been working with OpenCV and Apple's Accelerate framework and find the performance of Accelerate to be slow and Apple's documentation limited. Let's take for example: void equalizeHistogram(const cv::Mat &planar8Image, cv::Mat &equalizedImage) { cv::Size size = planar8Image.size(); vImage_Buffer planarImageBuffer = { .width = static_cast<vImagePixelCount>(size.width), .height = static_cast<vImagePixelCount>(size.height), .rowBytes = planar8Image.step, .data = planar8Image.data }; vImage_Buffer equalizedImageBuffer = { .width = static_cast<vImagePixelCount>(size.width), .height = static