IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Addition with a scalarSee full documentation
imageaddScalarImg (inImg,inArithmeticVal)

Detailed Description

addition of an input image and a scalar

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

\[ OutImg[i] = InImg[i] + 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 image and scalar
outImg = arithm.addScalarImg(inImg, 1.0)

Example of C++ code :

Example informations

Header file

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

Code Example

// Sample with a generated output image
// ------------------------------------
// compute multiplication for input images
ImagePtr pAutoOutImg = addScalarImg(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
addScalarImg(pInImg, fInArithmeticVal, pOutImg);