IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

multiplication of an input image and a scalar More...

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::multiplyScalarImg (const image::ImageConstPtr &pInImg, const ipReal64 inArithmeticVal)
 wrapper function for multiplication of an image and a scalar More...
 
IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::multiplyScalarImg (const image::ImageConstPtr &pInImg, const ipReal64 inArithmeticVal, const image::ImagePtr &pOutImg)
 wrapper function for multiplication of an image and a scalar More...
 

Detailed Description

multiplication of an input image and a scalar

Multiplication of an input image InImg and a scalar InArithmeticVal. On output image values are given by:

\[ OutImg[i] = InImg1[i] \times InArithmeticVal \]

Input and output images must have same size.

The scalar value is cast into the greatest type between the input and the output image. If both images have integer values whereas the salar has a real value, precision will be lost.

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::attr::InArithmeticVal [Input] value used for arithmetic operations X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation promoteUnary (_pOutImg, _pInImg, ipsdk::imaproc::ePromoteUnaryType::ePUT_UpperSigned)

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
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# addition of the input image and scalar 3.0
outImg = arithm.multiplyScalarImg(inImg, 3.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 = multiplyScalarImg(pInImg, fInArithmeticVal);
// 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
multiplyScalarImg(pInImg, fInArithmeticVal, pOutImg);
See also
MultiplyScalarImgLvl1
MultiplyScalarImgLvl2
MultiplyScalarImgLvl3

Function Documentation

◆ multiplyScalarImg() [1/2]

IPSDKIPLARITHMETIC_API image::ImagePtr ipsdk::imaproc::arithm::multiplyScalarImg ( const image::ImageConstPtr pInImg,
const ipReal64  inArithmeticVal 
)

wrapper function for multiplication of an image and a scalar

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ multiplyScalarImg() [2/2]

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::multiplyScalarImg ( const image::ImageConstPtr pInImg,
const ipReal64  inArithmeticVal,
const image::ImagePtr pOutImg 
)

wrapper function for multiplication of an image and a scalar

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure