A Laplacian pyramid is an image representation consisting of a set of band-pass images and a low-frequency residual.
Applications range from image compression to detail manipulation, where the input image is decomposed into frequency bands represented as a Laplacian pyramid. Each band can be manipulated independently. The final image can be reconstructed by summing up all bands and the low-frequency residual.
Input
Gaussian Pyramid Output (optional)
Laplacian Pyramid Output
Implementation
VPI implements an approximated Laplacian pyramid as a difference of Gaussian pyramids, as shown below:
The kth level of Laplacian pyramid can be obtained by the following formula:
\[ L_k(I) = G_k(I) - u(G_{k+1}(I)) \]
Where:
\(I\) is the input image.
\(L_k(I)\) is the kth level of Laplacian pyramid.
\(G_k(I)\) is the kth level of Gaussian pyramid.
\(u(\bullet)\) is a 2x scale-up operation.
The algorithm repeats until all levels are generated.
The VPI implementation optionally returns the intermediate Gaussian pyramid used in computation, in case this representation is also needed. There is no performance penalty in doing so.
C API functions
For list of limitations, constraints and backends that implements the algorithm, consult reference documentation of the following functions:
Returns the 4-level Laplacian pyramid created from the input image using the CUDA backend. It also returns the corresponding gaussian pyramid. Input is a VPI image, and outputs are VPI pyramids.
Optionally, create the Gaussian pyramid with the same dimensions as the Laplacian pyramid output. Its image format must be the same of the input image:
Submit the algorithm to the stream, along with the input image, output pyramid, and optional Gaussian pyramid. The algorithm is executed by the CPU backend:
The coarsest level of the Laplacian pyramid is equivalent in concept to that of the Gaussian pyramid. However, in cases where the Laplacian pyramid output format has less positive dynamic range than the input format, i.e. the input format is VPI_IMAGE_FORMAT_U8 and the output format is VPI_IMAGE_FORMAT_S8 or U16 and S16, the pixel values of the output in the coarsest level are divided by 2 to avoid overflow.