IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Polar to cartesian transformation

computation of the polar to cartesian coordinates transformation More...

IPSDKIPLARITHMETIC_API CartesianImg ipsdk::imaproc::arithm::polarToCartesianImg (const image::ImageConstPtr &pInRhoImg, const image::ImageConstPtr &pInThetaImg)
 wrapper function for polar to cartesian coordinates transformation More...
 
IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::polarToCartesianImg (const image::ImageConstPtr &pInRhoImg, const image::ImageConstPtr &pInThetaImg, const image::ImagePtr &pOutXImg, const image::ImagePtr &pOutYImg)
 wrapper function for polar to cartesian coordinates transformation More...
 

Detailed Description

computation of the polar to cartesian coordinates transformation

This algorithm computes the polar to cartesian coordinates transformations of input images $InRhoImg$ and $InThetaImg$ :

\[ OutXImg[i] = InRhoImg[i] \times cos(InThetaImg[i]) \]

and

\[ OutYImg[i] = InRhoImg[i] \times sin(InThetaImg[i]) \]

For more informations report to Points and vectors 2d representation

See also
https://en.wikipedia.org/wiki/Polar_coordinate_system

Attributes description

Attribute description for algorithm :

Name ToolTip Default Initializer
ipsdk::imaproc::attr::InRhoImg [Input] rho component of polar coordinates X
ipsdk::imaproc::attr::InThetaImg [Input] theta component of polar coordinates X
ipsdk::imaproc::attr::OutXImg [Output] x component of cartesian coordinates duplicateInOut (_pOutXImg, _pInRhoImg)
ipsdk::imaproc::attr::OutYImg [Output] y component of cartesian coordinates duplicateInOut (_pOutYImg, _pInRhoImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInRhoImg,_pInThetaImg,_pOutXImg,_pOutYImg)

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLArithmetic as arithm

Code Example

# opening of input images
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# gaussian gradient filter 2d computation
# (requesting floating point output images)
gxImg = PyIPSDK.createImage(PyIPSDK.eImageBufferType.eIBT_Real32,
inImg.getSizeX(), inImg.getSizeY())
gyImg = PyIPSDK.createImage(PyIPSDK.eImageBufferType.eIBT_Real32,
inImg.getSizeX(), inImg.getSizeY())
filter.gaussianGradient2dImg(inImg, 1.5, 1.5, PyIPSDK.createGaussianCoverage(0.997, 2), gxImg, gyImg)
# computation of cartesian to polar transformation
rhoImg, thetaImg = arithm.cartesianToPolarImg(gxImg, gyImg)
# come back to cartesian representation
# (ie outXImg == gxImg and outYImg == gyImg)
outXImg, outYImg = arithm.polarToCartesianImg(rhoImg, thetaImg)

Example of C++ code :

Example informations

Associated library

IPSDKIPLArithmetic

Header file

Code Example

// opening input image
ImagePtr pInImg = loadTiffImageFile(inputImgPath);
// computation of associated gradient image
// (requesting floating point output images)
ImageGeometryPtr pGradientGeometry = geometry2d(eImageBufferType::eIBT_Real32,
pInImg->getSizeX(), pInImg->getSizeY());
MemoryImagePtr pGxImg(boost::make_shared<MemoryImage>());
pGxImg->init(*pGradientGeometry);
MemoryImagePtr pGyImg(boost::make_shared<MemoryImage>());
pGyImg->init(*pGradientGeometry);
gaussianGradient2dImg(pInImg, 1.5f, 1.5f, createGaussianCoverage(0.997f, 2), pGxImg, pGyImg);
// computation of cartesian to polar transformation
PolarImg polarData = cartesianToPolarImg(pGxImg, pGyImg);
// come back to cartesian representation
// (ie *pOutXImg == *pGxImg and *pOutYImg == *pGyImg)
CartesianImg cartesianData = polarToCartesianImg(polarData._pRhoImg, polarData._pThetaImg);
ImagePtr pOutXImg = cartesianData._pXImg;
ImagePtr pOutYImg = cartesianData._pYImg;
See also
PolarToCartesianImgLvl1
PolarToCartesianImgLvl2
PolarToCartesianImgLvl3

Function Documentation

◆ polarToCartesianImg() [1/2]

IPSDKIPLARITHMETIC_API CartesianImg ipsdk::imaproc::arithm::polarToCartesianImg ( const image::ImageConstPtr pInRhoImg,
const image::ImageConstPtr pInThetaImg 
)

wrapper function for polar to cartesian coordinates transformation

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ polarToCartesianImg() [2/2]

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::polarToCartesianImg ( const image::ImageConstPtr pInRhoImg,
const image::ImageConstPtr pInThetaImg,
const image::ImagePtr pOutXImg,
const image::ImagePtr pOutYImg 
)

wrapper function for polar to cartesian coordinates transformation

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure