image = | linearCombineImgImg (inImg1,inImg2,inFactor1,inFactor2) |
linear combination of 2 images, pixel by pixel
On output image values are given by:
(with
and
the constant scalar parameters of the linear combination;
and
are encoded on ipReal32
means that, if the result of
is out of the range of OutImg buffer data type, then OutImg[i] equals to the limit of this range that is closest to this result.
Input and output images must have same size.
Here is an example of a linear combination applied to two 8-bits grey level images, with inFactor1=1.0f and inFactor2=-0.5f:
Example of Python code :
Example imports
import PyIPSDK
import PyIPSDK.IPSDKIPLArithmetic as arithm
Code Example
geometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_Real32, 510, 509)
inImg1 = PyIPSDK.loadRawImageFile(inputImg1Path, geometry)
inImg2 = PyIPSDK.loadRawImageFile(inputImg2Path, geometry)
outImg = arithm.linearCombineImgImg(inImg1, inImg2, 0.4, 0.6)
Example of C++ code :
Example informations
Header file
#include <IPSDKIPL/IPSDKIPLArithmetic/Processor/LinearCombineImgImg/LinearCombineImgImg.h>
Code Example
ImagePtr pAutoOutImg = linearCombineImgImg(
pInImg1,
pInImg2,
inFactor1,
inFactor2);
boost::shared_ptr<MemoryImage> pOutImg(boost::make_shared<MemoryImage>());
pOutImg->init(*pOutputImageGeometry);
linearCombineImgImg(pInImg1, pInImg2, inFactor1, inFactor2, pOutImg);