IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

blending of 2 images More...

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::blendImgImg (const image::ImageConstPtr &pInImg1, const image::ImageConstPtr &pInImg2, const ipReal32 inOptBlendMultiplier)
 wrapper function for blending on 2 images More...
 
IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::blendImgImg (const image::ImageConstPtr &pInImg1, const image::ImageConstPtr &pInImg2, const ipReal32 inOptBlendMultiplier, const image::ImagePtr &pOutImg)
 wrapper function for blending on 2 images More...
 

Detailed Description

blending of 2 images

On output image values are given by:

\[ OutImg[i] = \alpha \cdot InImg1[i] + (1-\alpha) \cdot InImg2[i] \]

(with $\alpha$ corresponding to the multiplier parameter of the blending operation $InBlendMultiplier$; $\alpha$ is encoded on a ipReal32, and $\alpha \in [0;1]$)

Input and output images must have same size.

Here is an example of a blending operation applied to two 8-bits grey level images with $InBlendMultiplier=0.6$:

blendImg.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg1 [Input] First image for processing operation X
ipsdk::imaproc::attr::InImg2 [Input] Second image for processing operation X
ipsdk::imaproc::attr::InOptBlendMultiplier [Input Optional] Multiplier value used for image blending operation X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation promoteBinary (_pOutImg, _pInImg1, _pInImg2, ipsdk::imaproc::ePromoteBinaryType::ePBT_Upper)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInImg1,_pInImg2,_pOutImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLArithmetic as arithm

Code Example

# opening input images
inImg1 = PyIPSDK.loadTiffImageFile(inputImg1Path)
inImg2 = PyIPSDK.loadTiffImageFile(inputImg2Path)
# images blending
outImg = arithm.blendImgImg(inImg1, inImg2, 0.4)

Example of C++ code :

Example informations

Associated library

IPSDKIPLArithmetic

Header file

Code Example

// open input images
ImageGeometryPtr pInputImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg1 = loadRawImageFile(in1Path, *pInputImageGeometry);
ImagePtr pInImg2 = loadRawImageFile(in2Path, *pInputImageGeometry);
// Sample with a generated output image
// ------------------------------------
// compute blend for input images
ImagePtr pAutoOutImg = blendImgImg(pInImg1, pInImg2, 0.4f);
// Sample with a provided output image
// -----------------------------------
// create output image
ImageGeometryPtr pOutputImageGeometry = geometry2d(outType, sizeX, sizeY);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutputImageGeometry);
// compute blend of input images
blendImgImg(pInImg1, pInImg2, 0.4f, pOutImg);
See also
BlendImgImgLvl1
BlendImgImgLvl2
BlendImgImgLvl3

Function Documentation

◆ blendImgImg() [1/2]

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::blendImgImg ( const image::ImageConstPtr pInImg1,
const image::ImageConstPtr pInImg2,
const ipReal32  inOptBlendMultiplier 
)

wrapper function for blending on 2 images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ blendImgImg() [2/2]

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::blendImgImg ( const image::ImageConstPtr pInImg1,
const image::ImageConstPtr pInImg2,
const ipReal32  inOptBlendMultiplier,
const image::ImagePtr pOutImg 
)

wrapper function for blending on 2 images

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure