Generic Static Method

deconvolve(_:reference:kernel:)

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

Declaration

static func deconvolve<A, T, C>(_ pixels:[C], reference:(A) -> Int, kernel:(C) -> T) -> [UInt8] where A:FixedWidthInteger & UnsignedInteger, T:FixedWidthInteger & UnsignedInteger

Parameters

pixels

A pixel array.

reference

A referencing function. Its return value must be in the range 0 ... 255. Depending on bit depth of the image it is being used for, there may be further restrictions on the range of the returned indices.

kernel

A pixel kernel.

Return value

An image data buffer. This array has the same number of elements as pixels.

Overview

This function maps the given kernel function over each element in pixels, receiving scalar intensities of type T in return. It then converts them into atoms of type A, scaling each intensity value to the range of A. Each scalar atom is then converted to an Int index using the given reference function, and stored as a byte in the returned image data buffer.

A worked example of how to use this function to implement a custom color target can be found in the custom color targets tutorial.

Topics

See also

static func deconvolve<A, T, C>([C], reference:((A, A)) -> Int, kernel:(C) -> (T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

static func deconvolve<A, T, C>([C], reference:((A, A, A)) -> Int, kernel:(C) -> (T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

static func deconvolve<A, T, C>([C], reference:((A, A, A, A)) -> Int, kernel:(C) -> (T, T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> T) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> (T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> (T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> (T, T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.