You are here: Start » Function Reference » Image » Image Combinators » BlendImages
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Computes weighted sum pixel by pixel.
Syntax
void fil::BlendImages ( const fil::Image& inImage1, const fil::Image& inImage2, ftl::Optional<const fil::Region&> inRoi, float inAmount1, float inAmount2, fil::Image& outImage )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inImage1 | const Image& | First input image | ||
![]() |
inImage2 | const Image& | Second input image | ||
![]() |
inRoi | Optional<const Region&> | NIL | Range of pixels to be processed | |
![]() |
inAmount1 | float | -![]() ![]() |
0.5f | |
![]() |
inAmount2 | float | -![]() ![]() |
0.5f | |
![]() |
outImage | Image& | Output image |
In-place Processing
This function supports in-place data processing - you can pass the same reference to inImage1 and outImage, inImage2 and outImage
Read more about In-place Computation.
Description
The operation computes the weighted sum of the corresponding pixels of the input images.
Note that the sum of selected weight need not to equal 1.0, but only when the sum is less or equal to 1.0
the resulting value is guaranteed to fit in the range of pixel values.
Whenever the resulting value exceeds the range of pixel values, it is clipped to the nearest proper value. In multichannel (color) images each pixel channel is processed separately.
The operation requires that the images being processed have equal format and dimensions, otherwise an error with appropriate description occurs. To obtain an image of desired dimensions one can use ResizeImage or CropImage filter. To alter the pixel type of an image one can use ConvertPixelType filter. ConvertToMultichannel and AverageChannels filters allow to alter the number of image channels.
Examples
![]() |
![]() |
![]() |
BlendImages performed on the sample images with inAmount1 = 0.3, inAmount2 = 0.7.
Hardware Acceleration
This operation is optimized for SSE2 technology for pixels of types: UINT8, SINT16, REAL.
This operation is optimized for AVX2 technology for pixels of types: UINT8, SINT16, REAL.
This operation is optimized for NEON technology for pixels of types: UINT8, SINT8, UINT16, SINT16, SINT32.
This operation supports automatic parallelization for multicore and multiprocessor systems.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Image formats are not the same in BlendImages. |
DomainError | Image sizes are not equal in BlendImages. |
DomainError | Region exceeds an input image in BlendImages. |
See Also
- AverageImages – Averages two images pixel by pixel.
- LerpImages – Interpolates two images linearly pixel by pixel.