Overview
The Blender API provides multi-band and feather blending algorithms for seamless image composition. It supports pyramid-based blending with configurable band levels.Types
BlenderType
Enumeration of available blending algorithms.Multi-band blending using Laplacian pyramids for smooth transitions between images
Simple feather blending using weighted averaging based on mask values
Blender
Main blender structure containing blending state and buffers.Number of pyramid levels for multi-band blending
Requested output dimensions
Actual output dimensions after processing
Array of widths for each pyramid level
Array of heights for each pyramid level
Floating-point accumulation buffer for blended output
Floating-point mask accumulation buffer
Short integer intermediate output buffer
Final blended image (unsigned char)
Laplacian pyramid for multi-band blending
Gaussian pyramid of masks
Algorithm type (MULTIBAND or FEATHER)
Sharpness parameter for blending
Whether to apply distance transform to masks
Functions
create_blender
Creates and initializes a new blender instance.Type of blending algorithm to use (MULTIBAND or FEATHER)
Output image dimensions and position
Number of pyramid bands for MULTIBAND (ignored for FEATHER, use -1)
Pointer to newly created Blender instance, or NULL on failure
For FEATHER blending, pass -1 for the
nb parameter as band count is not used.Example
feed
Feeds an image and its mask into the blender for composition.Pointer to the Blender instance
Source image to blend
Mask image defining blending weights (same dimensions as img)
Top-left position where the image should be placed in output canvas
0 on success, non-zero on failure
The mask should be a grayscale image where pixel values indicate blending weight (0-255). Higher values mean more contribution from the source image.
Example
blend
Performs the blending operation on all fed images.Pointer to the Blender instance with fed images
Call this after feeding all images. The result will be available in
b->result.Example
destroy_blender
Frees all resources associated with a blender instance.Pointer to the Blender instance to destroy
Always call this function when finished to prevent memory leaks.