IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

algorithm allowing to apply a motion transformation warping operation on a 2d image More...

IPSDKIPLGEOMETRICTRANSFORM_API image::ImagePtr ipsdk::imaproc::gtrans::warp2dImg (const image::ImageConstPtr &pInImg, const attr::WarpMotionTransform2dConstPtr &pInWarpMotionTransform2d, const attr::eInterpolationPolicy &inOptInterpolationPolicy)
 wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image More...
 
IPSDKIPLGEOMETRICTRANSFORM_API image::ImagePtr ipsdk::imaproc::gtrans::warp2dImg (const image::ImageConstPtr &pInImg, const attr::WarpMotionTransform2dConstPtr &pInWarpMotionTransform2d)
 wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image More...
 
IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::warp2dImg (const image::ImageConstPtr &pInImg, const attr::WarpMotionTransform2dConstPtr &pInWarpMotionTransform2d, const image::ImagePtr &pOutImg)
 wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image More...
 
IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::warp2dImg (const image::ImageConstPtr &pInImg, const attr::WarpMotionTransform2dConstPtr &pInWarpMotionTransform2d, const attr::eInterpolationPolicy &inOptInterpolationPolicy, const image::ImagePtr &pOutImg)
 wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image More...
 
IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::warp2dImg (const image::ImageConstPtr &pInImg, const attr::WarpMotionTransform2dConstPtr &pInWarpMotionTransform2d, const attr::eInterpolationPolicy &inOptInterpolationPolicy, const image::ImagePtr &pOutImg, const image::ImagePtr &pOutOptMaskImg)
 wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image More...
 
IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::computeWarpedDefaultSize (const attr::WarpMotionTransform2d &motionTransform, const image::BaseImage &inputImg, ipUInt64 &outputSizeX, ipUInt64 &outputSizeY)
 function allowing to compute default output size for a warping transformation 2d
 
IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::computeWarpedDefaultSize (const attr::WarpMotionTransform2d &motionTransform, const ipUInt64 inputSizeX, const ipUInt64 inputSizeY, ipUInt64 &outputSizeX, ipUInt64 &outputSizeY)
 function allowing to compute default output size for a warping transformation 2d
 

Detailed Description

algorithm allowing to apply a motion transformation warping operation on a 2d image

This algorithm allows to apply a motion transformation defined by parameter $InWarpMotionTransform2d$ on an input image $InImg$. Available warping transformations are defined by enumerate ipsdk::math::transform::eGeometricTransform2dType.

Interpolation policy used during processing is defined by optional input parameter $InOptInterpolationPolicy$ (see ipsdk::imaproc::attr::eInterpolationPolicy).

On output, algorithm generates requested warped image $OutImg$ and optionally output mask image $OutOptMaskImg$. Size of output image is not ruled :

This process is illustrated by following figure :

warp2dImg1.png

If output image is not provided by user, a default output image size is computed using computeWarpedDefaultSize function.

Here is an example of application of Warp2dImg algorithm on a 2d image, in this case we apply a centered rotation on input image :

warp2dImg2.png

Here is another example of application of Warp2dImg algorithm on a 2d image, in this case we apply an homography on input image :

warp2dImg3.png

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InImg [Input] image for processing operation X
ipsdk::imaproc::gtrans::InWarpMotionTransform2d [Input] motion transformation parameters associated to 2d warp operations X
ipsdk::imaproc::attr::InOptInterpolationPolicy [Input Optional] interpolation policy used to extract local data from image X
ipsdk::imaproc::attr::InOptTargetTile2dSideLength [Input Optional] target processing size for tile 2d (side length) X
ipsdk::imaproc::attr::OutImg [Output] image for processing operation customOutput (_pOutImg, outputWarp(_pInImg,_pInWarpMotionTransform2d))
ipsdk::imaproc::attr::OutOptMaskImg [Output Optional] mask image for processing operation X

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchBufferType (_pInImg,_pOutImg) && 
ipsdk::imaproc::matchSize (ipsdk::imaproc::eMatchImageSizeType::eMIST_ZCT,_pInImg,_pOutImg) && 
ipsdk::processor::ifIsSet (_pOutOptMaskImg,
 ipsdk::imaproc::match2dMask (_pOutImg,_pOutOptMaskImg))

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLGeometricTransform as gtrans

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# case of a translation transformation
transform1 = PyIPSDK.createWarpMotionTransform2d(PyIPSDK.eGeometricTransform2dType.eGT2DT_Translation,
[10, 30])
outImg1 = gtrans.warp2dImg(inImg, transform1)
# case of a rotation transformation with retrieval of output optional mask image
# In this case we compute a suitable output image size and allocate
# output image and output optional mask
transform2 = PyIPSDK.createCenteredRotation(math.pi/3, inImg)
outputSizeX, outputSizeY = gtrans.computeWarpedDefaultSize(transform2, inImg)
outImg2 = PyIPSDK.createImageRgb(PyIPSDK.eImageBufferType.eIBT_UInt8, outputSizeX, outputSizeY)
outOptMaskImg2 = PyIPSDK.createImage(PyIPSDK.eImageBufferType.eIBT_Binary, outputSizeX, outputSizeY)
gtrans.warp2dImg(inImg, transform2, PyIPSDK.eInterpolationPolicy.eIP_Cubic, outImg2, outOptMaskImg2)

Example of C++ code :

Example informations

Associated library

IPSDKIPLGeometricTransform

Header file

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// case of a translation transformation
math::transform::Translation2d translation(10, 30);
ImagePtr pOutImg1 = warp2dImg(pInImg, pTransform1);
// case of a rotation transformation with retrieval of output optional mask image
// In this case we compute a suitable output image size and allocate
// output image and output optional mask
WarpMotionTransform2dConstPtr pTransform2 = createCenteredRotation(M_PI / 3, *pInImg);
ipUInt64 outputSizeX, outputSizeY;
computeWarpedDefaultSize(*pTransform2, *pInImg, outputSizeX, outputSizeY);
ImageGeometryPtr pOutGeometry2 = geometryRgb2d(pInImg->getBufferType(), outputSizeX, outputSizeY);
MemoryImagePtr pOutImg2(boost::make_shared<MemoryImage>());
pOutImg2->init(*pOutGeometry2);
ImageGeometryPtr pOutMaskGeometry2 = geometry2d(eImageBufferType::eIBT_Binary, outputSizeX, outputSizeY);
MemoryImagePtr pOutOptMaskImg2(boost::make_shared<MemoryImage>());
pOutOptMaskImg2->init(*pOutMaskGeometry2);
warp2dImg(pInImg, pTransform2, eInterpolationPolicy::eIP_Cubic, pOutImg2, pOutOptMaskImg2);
See also
Warp2dImgLvl1
Warp2dImgLvl2
Warp2dImgLvl3

Function Documentation

◆ warp2dImg() [1/5]

IPSDKIPLGEOMETRICTRANSFORM_API image::ImagePtr ipsdk::imaproc::gtrans::warp2dImg ( const image::ImageConstPtr pInImg,
const attr::WarpMotionTransform2dConstPtr pInWarpMotionTransform2d,
const attr::eInterpolationPolicy inOptInterpolationPolicy 
)

wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ warp2dImg() [2/5]

IPSDKIPLGEOMETRICTRANSFORM_API image::ImagePtr ipsdk::imaproc::gtrans::warp2dImg ( const image::ImageConstPtr pInImg,
const attr::WarpMotionTransform2dConstPtr pInWarpMotionTransform2d 
)

wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ warp2dImg() [3/5]

IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::warp2dImg ( const image::ImageConstPtr pInImg,
const attr::WarpMotionTransform2dConstPtr pInWarpMotionTransform2d,
const image::ImagePtr pOutImg 
)

wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ warp2dImg() [4/5]

IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::warp2dImg ( const image::ImageConstPtr pInImg,
const attr::WarpMotionTransform2dConstPtr pInWarpMotionTransform2d,
const attr::eInterpolationPolicy inOptInterpolationPolicy,
const image::ImagePtr pOutImg 
)

wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ warp2dImg() [5/5]

IPSDKIPLGEOMETRICTRANSFORM_API void ipsdk::imaproc::gtrans::warp2dImg ( const image::ImageConstPtr pInImg,
const attr::WarpMotionTransform2dConstPtr pInWarpMotionTransform2d,
const attr::eInterpolationPolicy inOptInterpolationPolicy,
const image::ImagePtr pOutImg,
const image::ImagePtr pOutOptMaskImg 
)

wrapper function for algorithm allowing to apply a motion transformation warping operation on a 2d image

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure