vImage is a library of high-performance image-processing routines provided by Apple in macOS, iOS, tvOS, and watchOS. It includes functions for image manipulation—convolutions, geometric transformations, histogram operations, morphological transformations, and alpha compositing—as well as utility functions for format conversions and other operations.
Questions tagged [vimage]
62 questions
13
votes
2 answers
Combining CGBitmapInfo and CGImageAlphaInfo in Swift
I'm rewriting Apple's UIImageEffects sample code from Objective-C to Swift and I have a question regarding the following line:
vImage_CGImageFormat format = {
.bitsPerComponent = 8,
.bitsPerPixel = 32,
.colorSpace = NULL,
.bitmapInfo…

Rudolf Adamkovič
- 31,030
- 13
- 103
- 118
12
votes
2 answers
How to go from vImage_Buffer to CVPixelBufferRef
I'm recording live video in my iOS app. On another Stack Overflow page, I found that you can use vImage_Buffer to work on my frames.
The problem is that I have no idea how to get back to a CVPixelBufferRef from the outputted vImage_buffer.
Here is…

Nils Ziehn
- 4,118
- 6
- 26
- 40
9
votes
2 answers
How to cast UnsafeMutableRawPointer! to UnsafeMutablePointer in Swift 3.0 or newer?
I am working with Accelerate library for my iOS app. I built this app in Swift 2.0 a couple years ago and it was working fine. Now that Swift is updated to 3.0 and 4.0, I have to convert most of the code to the current syntax. I have run the…

Keen R.D.
- 123
- 1
- 5
6
votes
1 answer
iOS using vImage - Accelerate to convert QCAR YUV to RGB
I'm trying to test the performance of converting YUV images produced by Vuforia and converting them to UIImage using the iOS Accelerate Framework's vImage calls. In the current state of the code I'm just trying to get it to work. Right now…

Cameron Lowell Palmer
- 21,528
- 7
- 125
- 126
6
votes
3 answers
iOS Accelerate Framework vImage - Performance improvement?
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…

Cameron Lowell Palmer
- 21,528
- 7
- 125
- 126
6
votes
5 answers
How-to convert an iOS camera image to greyscale using the Accelerate Framework?
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
…

Brett
- 11,637
- 34
- 127
- 213
4
votes
2 answers
CMSampleBuffer frame converted to vImage has wrong colors
I’m trying to convert CMSampleBuffer from camera output to vImage and later apply some processing. Unfortunately, even without any further editing, frame I get from buffer has wrong colors:
Implementation (Memory management and errors are not…

Dawid
- 715
- 2
- 10
- 17
4
votes
0 answers
Correctly freeing a buffer from vImageBuffer_InitWithCVPixelBuffer
I'm attempting to convert CVPixelBufferRefs from a video source to CGImageRefs using vImage convert libraries on 10.10. This for the most part works fine. However, each time I initialize a new vImage_Buffer from my CVPixelBufferRef, memory is…

Dimitri Bouniol
- 735
- 11
- 15
4
votes
3 answers
Compute the histogram of an image using vImageHistogramCalculation in swift
I'm trying to compute the histogram of an image using Accelerate vImageHistogramCalculation_ARGBFFFF function, but I'm getting a vImage_Error of type kvImageNullPointerArgument (error code is -21772).
This is the exact same question, but I'm working…

Marco
- 1,057
- 1
- 19
- 36
4
votes
1 answer
Compute the histogram of an image using vImageHistogramCalculation
I'm trying to compute the histogram of an image using vImage's vImageHistogramCalculation_ARGBFFFF, but I'm getting a vImage_Error of type kvImageNullPointerArgument (error code a -21772).
Here's my code:
- (void)histogramForImage:(UIImage *)image…

Eric
- 16,003
- 15
- 87
- 139
3
votes
2 answers
Accelerate's vImage vs. vDSP
I'm trying to use the Accelerate framework on iOS to bypass the fact that Core Image on iOS doesn't support custom filters/kernels. I'm developing an edge detection filter using two convolutions with a Sobel kernel, but starting with a simple…

mgaldieri
- 143
- 1
- 7
3
votes
2 answers
Bad performance of GCContextDrawImage due to it calling suspicious debug functions
A call to GCContextDrawImage turned out to be a bottleneck in my Mac OS X application, especially on retina screens. I managed to mitigate it somewhat by Avoiding colorspace transformations when blitting, Mac OS X 10.11 SDK, but it still seems to be…

finalman
- 774
- 5
- 14
3
votes
2 answers
Why can't I compile code referencing the vImage library on the iPhone?
I am trying to include vImage based functionality in my code. But compile fails - it doesnt even seem to recognize the functions/variables at all.
But at the same time vDSP based code seems to work fine. Also, the code compiles in simulator but…

Raj
- 43
- 3
2
votes
1 answer
is there any way to get pixel format information from vImage_Buffer in swift?
I am using vImage_Buffer for image processing like gray scale conversion.
When I perform converting an image to gray scale, I need to know the pixel format of source image so that I can apply different coefficient for each color.
In other words, in…

Jex Jang
- 567
- 1
- 4
- 9
2
votes
2 answers
How to create vImage_CGImageFormat for YCbCr image?
I want to create a library that can convert any video frame captured using AVCaptureDevice to target pixel format. So, it must support kCVPixelFormatType_32BGRA, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,…

Alexander Ushakov
- 5,139
- 3
- 27
- 50