IPSDK 0.2
IPSDK : Image Processing Software Development Kit
imagesquareImg (inImg)

Detailed Description

computation of the square of an image

On output image values are given by:

\[ OutImg[i] = (InImg[i])^{2} \]

Input and output images must have same size

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLArithmetic as arithm

Code Example

# opening of input image
geometry = PyIPSDK.geometry2d(PyIPSDK.eImageBufferType.eIBT_Real32, 510, 509)
inImg = PyIPSDK.loadRawImageFile(inputImgPath, geometry)
# computation of the square of the input image
outImg = arithm.squareImg(inImg)

Example of C++ code :

Example informations

Header file

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

Code Example

// open input image
ImageGeometryPtr pInputImageGeometry = geometry2d(inType, sizeX, sizeY);
ImagePtr pInImg = loadRawImageFile(inPath, *pInputImageGeometry);
// Sample with a generated output image
// ------------------------------------
// compute subtraction for input image
ImagePtr pAutoOutImg = squareImg(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 square value of input image
squareImg(pInImg, pOutImg);