Mac Developer Library

Developer

Accelerate Framework Reference vImage Convolution Reference

Options
Deployment Target:

On This Page
Language:

vImage Convolution Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import Accelerate

Objective-C

@import Accelerate;

Convolution functions implement various techniques for smoothing or sharpening an image by replacing a pixel with a weighted sum of itself and nearby pixels. Image convolution does not alter the size of an image.

Each convolution function requires that you pass it a convolution kernel, which determines how the values of neighboring pixels are used to compute the value of a destination pixel. A kernel is a packed array, without padding at the ends of the rows. The elements of the array must be of type uint8_t (for the Planar8 and ARGB8888 formats) or of type float (for the PlanarF and ARGBFFFF formats). The height and the width of the array must both be odd numbers.

For example, a 3 x 3 convolution kernel for a Planar8 image consist of nine 8-bit (1-byte) values, arranged consecutively. The first three values represent the first row of the kernel, the next three values the second row, and the last three values the third row.

Typically, you use normalized values for the convolution kernel. For floating-point formats, this means the sum of the elements of the kernel is 1.0. For integer formats, the sum of the elements of the kernel, divided by the given divisor, is 1. A non-normalized kernel either lightens or darkens the image.

For integer formats, the sum of any subset of elements of the kernel must be in the range –224 to 224 – 1, inclusive to prevent integer overflow. If your kernel does not meet this restriction, either use a floating-point format or scale the kernel to use smaller values.

A convolution function transforms a source image as follows:

  1. Places the kernel over the image so that the center element of the kernel lies over the source pixel.

  2. For floating-point formats, performs this calculation:

    image: ../Art/float_kernel.pdf

    For integer formats, performs this calculation:

    image: ../Art/integer_kernel.jpg
  3. Assigns the result to the destination pixel.

If the image is in a planar format, the convolution operation uses the single-channel values of the pixels directly. If the image is in an interleaved format, the convolution operation processes each channel (alpha, red, green, and blue) separately. In both the planar and interleaved format, the kernel itself is always planar.

When the pixel to be transformed is near the edge of the image—not merely the region of interest, but the entire image of which it is a part—the kernel may extend beyond the edge of the image, so that there are no existing pixels beneath some of the kernel elements. In these cases you must pass a flag that specifies a technique for the convolution function to use: kvImageCopyInPlace, kvImageBackgroundColorFill, kvImageEdgeExtend, and kvImageTruncateKernel. For a discussion of these options, see vImage Data Types and Constants Reference.

Functions

  • Sharpens an ARGBFFFF image by undoing a previous convolution that blurred the image, such as diffraction effects in a camera lens.

    Declaration

    Swift

    func vImageRichardsonLucyDeConvolve_ARGBFFFF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Float>, _ kernel2: UnsafePointer<Float>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ kernel_height2: UInt32, _ kernel_width2: UInt32, _ backgroundColor: UnsafeMutablePointer<Float>, _ iterationCount: UInt32, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageRichardsonLucyDeConvolve_ARGBFFFF ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, const float *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, Pixel_FFFF backgroundColor, uint32_t iterationCount, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the deconvolution kernel data, which must be a packed array without any padding. The kernel expresses a blurring convolution or point-spread function.

    kernel2

    A pointer to the data of a second kernel, which must be a packed array without any padding. Supply this kernel only if the first kernel is asymmetrical; otherwise pass NULL.

    kernel_height

    The height of the first kernel in pixels. This value must be odd.

    kernel_width

    The width of the first kernel in pixels. This value must be odd.

    kernel_height2

    The height of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    kernel_width2

    The width of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    iterationCount

    The number of times to iterate the deconvolution algorithm.

    flags

    The options to use when performing the deconvolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    This function performs a Richardson-Lucy deconvolution of a region of interest within a source image by an M x N kernel, performing a specified number of iterations and placing the result in a destination buffer.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Sharpens an ARGB8888 image by undoing a previous convolution that blurred the image, such as diffraction effects in a camera lens.

    Declaration

    Swift

    func vImageRichardsonLucyDeConvolve_ARGB8888(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Int16>, _ kernel2: UnsafePointer<Int16>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ kernel_height2: UInt32, _ kernel_width2: UInt32, _ divisor: Int32, _ divisor2: Int32, _ backgroundColor: UnsafeMutablePointer<UInt8>, _ iterationCount: UInt32, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageRichardsonLucyDeConvolve_ARGB8888 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, const int16_t *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, int32_t divisor, int32_t divisor2, Pixel_8888 backgroundColor, uint32_t iterationCount, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the deconvolution kernel data, which must be a packed array without any padding. The kernel expresses a blurring convolution or point-spread function.

    kernel2

    A pointer to the data of a second kernel, which must be a packed array without any padding. Supply this kernel only if the first kernel is asymmetrical; otherwise pass NULL.

    kernel_height

    The height of the first kernel in pixels. This value must be odd.

    kernel_width

    The width of the first kernel in pixels. This value must be odd.

    kernel_height2

    The height of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    kernel_width2

    The width of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    divisor

    The divisor to be used in convolutions with the first kernel.

    divisor2

    The divisor to be used in convolutions with the second kernel.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    iterationCount

    The number of times to iterate the deconvolution algorithm.

    flags

    The options to use when performing the deconvolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    This function performs a Richardson-Lucy deconvolution of a region of interest within a source image by an M x N kernel, performing a specified number of iterations and placing the result in a destination buffer.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Sharpens a PlanarF image by undoing a previous convolution that blurred the image, such as diffraction effects in a camera lens.

    Declaration

    Swift

    func vImageRichardsonLucyDeConvolve_PlanarF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Float>, _ kernel2: UnsafePointer<Float>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ kernel_height2: UInt32, _ kernel_width2: UInt32, _ backgroundColor: Pixel_F, _ iterationCount: UInt32, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageRichardsonLucyDeConvolve_PlanarF ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, const float *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, Pixel_F backgroundColor, uint32_t iterationCount, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the deconvolution kernel data, which must be a packed array without any padding. The kernel expresses a blurring convolution or point-spread function.

    kernel2

    A pointer to the data of a second kernel, which must be a packed array without any padding. Supply this kernel only if the first kernel is asymmetrical; otherwise pass NULL.

    kernel_height

    The height of the first kernel in pixels. This value must be odd.

    kernel_width

    The width of the first kernel in pixels. This value must be odd.

    kernel_height2

    The height of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    kernel_width2

    The width of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    iterationCount

    The number of times to iterate the deconvolution algorithm.

    flags

    The options to use when performing the deconvolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    The function performs a Richardson-Lucy deconvolution of a region of interest within a source image by an M x N kernel, performing a specified number of iterations and placing the result in a destination buffer.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Sharpens a Planar8 image by undoing a previous convolution that blurred the image, such as diffraction effects in a camera lens.

    Declaration

    Swift

    func vImageRichardsonLucyDeConvolve_Planar8(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Int16>, _ kernel2: UnsafePointer<Int16>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ kernel_height2: UInt32, _ kernel_width2: UInt32, _ divisor: Int32, _ divisor2: Int32, _ backgroundColor: Pixel_8, _ iterationCount: UInt32, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageRichardsonLucyDeConvolve_Planar8 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, const int16_t *kernel2, uint32_t kernel_height, uint32_t kernel_width, uint32_t kernel_height2, uint32_t kernel_width2, int32_t divisor, int32_t divisor2, Pixel_8 backgroundColor, uint32_t iterationCount, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the deconvolution kernel data, which must be a packed array without any padding. The kernel expresses a blurring convolution or point-spread function.

    kernel2

    A pointer to the data of a second kernel, which must be a packed array without any padding. Supply this kernel only if the first kernel is asymmetrical; otherwise pass NULL.

    kernel_height

    The height of the first kernel in pixels. This value must be odd.

    kernel_width

    The width of the first kernel in pixels. This value must be odd.

    kernel_height2

    The height of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    kernel_width2

    The width of the second kernel in pixels (ignored if kernel2 is NULL). This value must be odd.

    divisor

    The divisor to be used in convolutions with the first kernel.

    divisor2

    The divisor to be used in convolutions with the second kernel.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    iterationCount

    The number of times to iterate the deconvolution algorithm.

    flags

    The options to use when performing the deconvolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    This function performs a Richardson-Lucy deconvolution of a region of interest within a source image by an M x N kernel, performing a specified number of iterations and placing the result in a destination buffer.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within an ARGBFFFF source image by an M x N kernel.

    Declaration

    Swift

    func vImageConvolve_ARGBFFFF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Float>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ backgroundColor: UnsafeMutablePointer<Float>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolve_ARGBFFFF ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, Pixel_FFFF backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image. offsets to a point within the source image to define the upper left-hand point of the region of interest.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.3 and later.

  • Convolves a region of interest within a source image by an M x N kernel, then divides the pixel values by a divisor.

    Declaration

    Swift

    func vImageConvolve_ARGB8888(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Int16>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ divisor: Int32, _ backgroundColor: UnsafeMutablePointer<UInt8>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolve_ARGB8888 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, Pixel_8888 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    divisor

    A value to divide the results of the convolution by. This is commonly used for normalization.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.3 and later.

  • Convolves a region of interest within a source image by an M x N kernel.

    Declaration

    Swift

    func vImageConvolve_PlanarF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Float>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ backgroundColor: Pixel_F, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolve_PlanarF ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, Pixel_F backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.3 and later.

  • Convolves a region of interest within a source image by an M x N kernel, then divides the pixel values by a divisor.

    Declaration

    Swift

    func vImageConvolve_Planar8(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Int16>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ divisor: Int32, _ backgroundColor: Pixel_8, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolve_Planar8 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, Pixel_8 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    divisor

    A value to divide the results of the convolution with. This is commonly used for normalization.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.3 and later.

  • Convolves a region of interest within an ARGB8888 source image by an M x N kernel, then normalizes the pixel values.

    Declaration

    Swift

    func vImageConvolveWithBias_ARGB8888(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Int16>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ divisor: Int32, _ bias: Int32, _ backgroundColor: UnsafeMutablePointer<UInt8>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolveWithBias_ARGB8888 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, Pixel_8888 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    divisor

    The value, for normalization purposes, to divide into the convolution results.

    bias

    The value to add to each element in the convolution result, before applying the divisor or performing any clipping.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within a PlanarF source image by an M x N kernel.

    Declaration

    Swift

    func vImageConvolveWithBias_PlanarF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Float>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ bias: Float, _ backgroundColor: Pixel_F, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolveWithBias_PlanarF ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, Pixel_F backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    bias

    The value to add to each element in the convolution result, before performing any clipping.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within a Planar8 source image by an M x N kernel, then normalizes the pixel values.

    Declaration

    Swift

    func vImageConvolveWithBias_Planar8(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Int16>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ divisor: Int32, _ bias: Int32, _ backgroundColor: Pixel_8, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolveWithBias_Planar8 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernel, uint32_t kernel_height, uint32_t kernel_width, int32_t divisor, int32_t bias, Pixel_8 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    divisor

    The value, for normalization purposes, to divide into the convolution results.

    bias

    The value to add to each element in the convolution result, before applying the divisor or performing any clipping.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within an ARGBFFFF source image by an M x N kernel.

    Declaration

    Swift

    func vImageConvolveWithBias_ARGBFFFF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel: UnsafePointer<Float>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ bias: Float, _ backgroundColor: UnsafeMutablePointer<Float>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolveWithBias_ARGBFFFF ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernel, uint32_t kernel_height, uint32_t kernel_width, float bias, Pixel_FFFF backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel

    A pointer to the convolution kernel data, which must be a packed array without any padding.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    bias

    The value to add to each element in the convolution result, before performing any clipping.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves each channel of a region of interest within an ARGBFFFF source image by one of the four M x N kernels.

    Declaration

    Swift

    func vImageConvolveMultiKernel_ARGBFFFF(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernels: UnsafeMutablePointer<UnsafePointer<Float>>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ biases: UnsafePointer<Float>, _ backgroundColor: UnsafeMutablePointer<Float>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolveMultiKernel_ARGBFFFF ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const float *kernels[4], uint32_t kernel_height, uint32_t kernel_width, const float biases[4], Pixel_FFFF backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernels

    An array of pointers to the data for four kernels. The first kernel is for the alpha channel, the second for red, the third for green, and the fourth for blue. The data for each kernel is a packed array of floating-point values.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    biases

    An array of four values to be added to each element of the convolution result for one channel, before clipping. The first value is for the alpha channel, the second for red, the third for green, and the fourth for blue

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves each channel of a region of interest within an ARGB8888 source image by one of the four M x N kernels, then divides the pixel values by one of the four divisors.

    Declaration

    Swift

    func vImageConvolveMultiKernel_ARGB8888(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernels: UnsafeMutablePointer<UnsafePointer<Int16>>, _ kernel_height: UInt32, _ kernel_width: UInt32, _ divisors: UnsafePointer<Int32>, _ biases: UnsafePointer<Int32>, _ backgroundColor: UnsafeMutablePointer<UInt8>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageConvolveMultiKernel_ARGB8888 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, const int16_t *kernels[4], uint32_t kernel_height, uint32_t kernel_width, const int32_t divisors[4], const int32_t biases[4], Pixel_8888 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernels

    An array of pointers to the data for four kernels. The first kernel is for the alpha channel, the second for red, the third for green, and the fourth for blue. The data for each kernel is a packed array of integer values.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    divisors

    An array of values, for normalization purposes, to divide into the convolution results. Supply one value for each channel.

    biases

    An array of four values to be added to each element of the convolution result for one channel, before clipping. The first value is for the alpha channel, the second for red, the third for green, and the fourth for blue

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within a Planar8 source image by an implicit M x N kernel that has the effect of a box filter.

    Declaration

    Swift

    func vImageBoxConvolve_Planar8(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel_height: UInt32, _ kernel_width: UInt32, _ backgroundColor: Pixel_8, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageBoxConvolve_Planar8 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, Pixel_8 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    This function uses an implicit divisor and an implicit kernel of specified size instead of a kernel provided by the caller.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within an ARGB8888 source image by an implicit M x N kernel that has the effect of a box filter.

    Declaration

    Swift

    func vImageBoxConvolve_ARGB8888(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel_height: UInt32, _ kernel_width: UInt32, _ backgroundColor: UnsafeMutablePointer<UInt8>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageBoxConvolve_ARGB8888 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, Pixel_8888 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    This function uses an implicit divisor and an implicit kernel of specified size instead of a kernel provided by the caller.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within a Planar8 source image by an implicit M x N kernel that has the effect of a tent filter.

    Declaration

    Swift

    func vImageTentConvolve_Planar8(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel_height: UInt32, _ kernel_width: UInt32, _ backgroundColor: Pixel_8, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageTentConvolve_Planar8 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, Pixel_8 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. . The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    This function uses an implicit divisor and an implicit kernel of specified size instead of a kernel provided by the caller.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Convolves a region of interest within an ARGB8888 source image by an implicit M x N kernel that has the effect of a tent filter.

    Declaration

    Swift

    func vImageTentConvolve_ARGB8888(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutablePointer<Void>, _ srcOffsetToROI_X: vImagePixelCount, _ srcOffsetToROI_Y: vImagePixelCount, _ kernel_height: UInt32, _ kernel_width: UInt32, _ backgroundColor: UnsafeMutablePointer<UInt8>, _ flags: vImage_Flags) -> vImage_Error

    Objective-C

    vImage_Error vImageTentConvolve_ARGB8888 ( const vImage_Buffer *src, const vImage_Buffer *dest, void *tempBuffer, vImagePixelCount srcOffsetToROI_X, vImagePixelCount srcOffsetToROI_Y, uint32_t kernel_height, uint32_t kernel_width, Pixel_8888 backgroundColor, vImage_Flags flags );

    Parameters

    src

    A pointer to a vImage buffer structure that contains data for the source image.

    dest

    A pointer to a vImage buffer data structure. You are responsible for filling out the height, width, and rowBytes fields of this structure, and for allocating a data buffer of the appropriate size. On return, the data buffer pointed to by this structure contains the destination image data. When you no longer need the data buffer, you must deallocate the memory. The size (number of rows and number of columns) of the destination buffer also specifies the size of the region of interest in the source buffer.

    tempBuffer

    A pointer to a temporary buffer. If you pass NULL, the function allocates the buffer, then deallocates it before returning. Alternatively, you can allocate the buffer yourself, in which case you are responsible for deallocating it when you is no longer need it.

    If you want to allocate the buffer yourself, see the Discussion for information on how to determine the minimum size that you must allocate.

    srcOffsetToROI_X

    The horizontal offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    srcOffsetToROI_Y

    The vertical offset, in pixels, to the upper-left pixel of the region of interest within the source image.

    kernel_height

    The height of the kernel in pixels. This value must be odd.

    kernel_width

    The width of the kernel in pixels. This value must be odd.

    backgroundColor

    A background color. If you supply a color, you must also set the kvImageBackgroundColorFill flag, otherwise the function ignores the color.

    flags

    The options to use when performing the convolution operation. You must set exactly one of the following flags to specify how vImage handles pixel locations beyond the edge of the source image: kvImageCopyInPlace, kvImageTruncateKernel, kvImageBackgroundColorFill, or kvImageEdgeExtend.

    Set the kvImageDoNotTile flag if you plan to perform your own tiling or use multithreading.

    Return Value

    kvImageNoError, otherwise it returns one of the error codes described in vImage Data Types and Constants Reference.

    Discussion

    This function uses an implicit divisor and an implicit kernel of specified size instead of a kernel provided by the caller.

    If you want to allocate the memory for the tempBuffer parameter yourself, call this function twice, as follows:

    1. To determine the minimum size for the temporary buffer, the first time you call this function pass the kvImageGetTempBufferSize flag. Pass the same values for all other parameters that you intend to use in for the second call. The function returns the required minimum size, which should be a positive value. (A negative returned value indicates an error.) The kvImageGetTempBufferSize flag prevents the function from performing any processing other than to determine the minimum buffer size.

    2. After you allocate enough space for a buffer of the returned size, call the function a second time, passing a valid pointer in the tempBuffer parameter. This time, do not pass the kvImageGetTempBufferSize flag.

    Import Statement

    Objective-C

    @import Accelerate;

    Swift

    import Accelerate

    Availability

    Available in OS X v10.4 and later.

  • Returns the minimum size, in bytes, for the temporary buffer that the caller supplies to any of the convolution functions.

    Deprecation Statement

    Use the kvImageGetTempBufferSize flag with the appropriate convolution function instead of calling this function.

    Declaration

    Objective-C

    size_t vImageGetMinimumTempBufferSizeForConvolution ( const vImage_Buffer *src, const vImage_Buffer *dest, uint32_t kernel_height, uint32_t kernel_width, vImage_Flags flags, size_t bytesPerPixel );

    Parameters

    src

    A pointer to the vImage buffer structure that you plan to pass to the convolution function.

    dest

    A pointer to the vImage buffer structure that you plan to pass to the convolution function.

    kernel_height

    The height, in pixels, of the kernel that you plan to use in the convolution function.

    kernel_width

    The width, in pixels, of the kernel that you plan to use in the convolution function.

    flags

    The flags that you plan to pass to the convolution function.

    bytesPerPixel

    The number of bytes in a pixel. Make sure to pass the value appropriate for the format of the pixel.

    Return Value

    The minimum size, in bytes, of the temporary buffer.

    Discussion

    This function does not depend on the data or rowBytes fields of the src or dest parameters; it only uses the height and width fields from those parameters. If the size of the images you are processing stay the same, then the required size of the buffer also stays the same. More specifically, if, between two calls to vImageGetMinimumTempBufferSizeForConvolution, the height and width of the src and dest parameters do not increase, and the other parameters remain the same, then the result of the vImageGetMinimumTempBufferSizeForConvolution does not increase. This makes it easy to reuse the same temporary buffer when you are processing a number of images of the same size, as in tiling.

    Import Statement

    Objective-C

    @import Accelerate;

    Availability

    Available in OS X v10.3 and later.

    Deprecated in OS X v10.4.