IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Subtraction of a scalar and an image

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

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

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.

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

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 = 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);
See also
SubtractScalarImgLvl1
SubtractScalarImgLvl2
SubtractScalarImgLvl3

Function Documentation

◆ subtractScalarImg() [1/2]

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

wrapper function for subtraction of a scalar and an image (scalar - image)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ subtractScalarImg() [2/2]

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

wrapper function for subtraction of a scalar and an image (scalar - image)

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure