IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Multiplication by a scalarSee full documentation
imagemultiplyScalarImg (inImg,inArithmeticVal)

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.

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

Header file

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

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