IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Subtraction of a scalar and an imageSee full documentation
imagesubtractScalarImg (inArithmeticVal,inImg)

Detailed Description

subtraction of a scalar and an image (scalar - image)

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

\[ OutImg[i] = InArithmeticVal - InImg[i] \]

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)
# subtraction of image and scalar
outImg = arithm.subtractScalarImg(250.0, inImg)

Example of C++ code :

Example informations

Header file

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

Code Example

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