IPSDK 0.2
IPSDK : Image Processing Software Development Kit
imageblendImgImg (inImg1,inImg2,inOptBlendMultiplier)

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

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

Header file

#include <IPSDKIPL/IPSDKIPLArithmetic/Processor/BlendImgImg/BlendImgImg.h>

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);