IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Addition between a ponderated image and a scalar

affine operation on grey levels of an image More...

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::multiplyAddScalarImg (const image::ImageConstPtr &pInImg, const ipReal64 inFactor, const ipReal64 inOffset)
 wrapper function for affine operation on an image More...
 
IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::multiplyAddScalarImg (const image::ImageConstPtr &pInImg, const ipReal64 inFactor, const ipReal64 inOffset, const image::ImagePtr &pOutImg)
 wrapper function for affine operation on an image More...
 

Detailed Description

affine operation on grey levels of an image

On output image values are given by:

\[ OutImg[i] = InFactor * InImg[i] + InOffset \]

with $ InFactor $ and $ InOffset $ parameters of the operations specified by the user.

The result of the operation automatically saturates if it is out of output image data type range.

Input and output images must have same size.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InFactor [Input] Multiplying factor. Used for instance by shading correction algorithm X
ipsdk::imaproc::attr::InOffset [Input] Offset. Used for instance by shading correction algorithm X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation promoteUnary (_pOutImg, _pInImg, ipsdk::imaproc::ePromoteUnaryType::ePUT_Upper)

Global Rule description

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

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLArithmetic as arithm

Code Example

# opening input image
geometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_Real32, 510, 509)
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# affine operation on the input image
outImg = arithm.multiplyAddScalarImg(inImg, 1.5, 10.0)

Example of C++ code :

Example informations

Associated library

IPSDKIPLArithmetic

Header file

Code Example

// Sample with a generated output image
// ------------------------------------
// compute multiplication for input images
ImagePtr pAutoOutImg = multiplyAddScalarImg(pInImg, factor, offset);
// 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 multiplication of input images
multiplyAddScalarImg(pInImg, factor, offset, pOutImg);
See also
MultiplyAddScalarImgLvl1
MultiplyAddScalarImgLvl2
MultiplyAddScalarImgLvl3

Function Documentation

◆ multiplyAddScalarImg() [1/2]

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::multiplyAddScalarImg ( const image::ImageConstPtr pInImg,
const ipReal64  inFactor,
const ipReal64  inOffset 
)

wrapper function for affine operation on an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiplyAddScalarImg() [2/2]

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::multiplyAddScalarImg ( const image::ImageConstPtr pInImg,
const ipReal64  inFactor,
const ipReal64  inOffset,
const image::ImagePtr pOutImg 
)

wrapper function for affine operation on an image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure