MPSImageGaussianPyramid
A filter that convolves an image with a Gaussian pyramid.
Declaration
class MPSImageGaussianPyramidOverview
The Gaussian image pyramid kernel is enqueued as an in-place operation using the encode(commandBuffer:inPlaceTexture:fallbackCopyAllocator:) method. All mip-map levels (after level 1) present in the provided image are filled using the provided filter kernel. The fallbackCopyAllocator parameter is not used. The Gaussian image pyramid kernel ignores the clipRect and offset properties, and fills the entirety of the mip-map levels. Recall the size of the nth mip-map level as:
w_n = max(1, floor(w_0 / 2^n))h_n = max(1, floor(h_0 / 2^n))
Where w_0 and h_0 are the width and height of the 0th level, respectively (i.e. the image dimensions themselves).
The Gaussian image pyramid is constructed as follows:
First, the 0th level mip-map of the input image is filtered with the specified convolution kernel. The default convolution filter kernel is
k = ww^T, wherew = [1/16, 1/4, 3/8, 1/4, 1/16 ]^T. You may also modify this kernel with acenterWeightparameter ofaresulting ink = ww^T, wherew = [(1/4 - a/2), 1/4, a, 1/4, (1/4 - a/2) ]^T, or you may provide a completely custom kernel.Afterwards, the image is down-sampled by removing all odd rows and columns, which defines the next level in the Gaussian image pyramid.
This procedure is continued until every mip-map level present in the image is filled with all the pyramid levels.