IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Cartesian to polar transformation

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

IPSDKIPLARITHMETIC_API PolarImg ipsdk::imaproc::arithm::cartesianToPolarImg (const image::ImageConstPtr &pInXImg, const image::ImageConstPtr &pInYImg)
 wrapper function for cartesian to polar coordinates transformation More...
 
IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::cartesianToPolarImg (const image::ImageConstPtr &pInXImg, const image::ImageConstPtr &pInYImg, const image::ImagePtr &pOutRhoImg, const image::ImagePtr &pOutThetaImg)
 wrapper function for cartesian to polar coordinates transformation More...
 

Detailed Description

computation of the cartesian to polar coordinates transformation

This algorithm computes the cartesian to polar coordinates transformations of input images $InXImg$ and $InYImg$ :

\[ OutRhoImg[i] = \sqrt{InXImg[i]^2+InYImg[i]^2} \]

and

\[ OutThetaImg[i] = atan2(InYImg[i], InXImg[i]) \]

with $OutRhoImg[i] \in [0,+\infty[$ and $OutThetaImg[i] \in [-\pi, \pi]$

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::InXImg [Input] x component of cartesian coordinates X
ipsdk::imaproc::attr::InYImg [Input] y component of cartesian coordinates X
ipsdk::imaproc::attr::OutRhoImg [Output] rho component of polar coordinates duplicateInOut (_pOutRhoImg, _pInXImg)
ipsdk::imaproc::attr::OutThetaImg [Output] theta component of polar coordinates duplicateInOut (_pOutThetaImg, _pInXImg)

Global Rule description

Global rule description for algorithm :
ipsdk::imaproc::matchSize (_pInXImg,_pInYImg,_pOutRhoImg,_pOutThetaImg)

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
outRhoImg, outThetaImg = arithm.cartesianToPolarImg(gxImg, gyImg)

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);
ImagePtr pOutRhoImg = polarData._pRhoImg;
ImagePtr pOutThetaImg = polarData._pThetaImg;
See also
CartesianToPolarImgLvl1
CartesianToPolarImgLvl2
CartesianToPolarImgLvl3

Function Documentation

◆ cartesianToPolarImg() [1/2]

IPSDKIPLARITHMETIC_API PolarImg ipsdk::imaproc::arithm::cartesianToPolarImg ( const image::ImageConstPtr pInXImg,
const image::ImageConstPtr pInYImg 
)

wrapper function for cartesian to polar coordinates transformation

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure

◆ cartesianToPolarImg() [2/2]

IPSDKIPLARITHMETIC_API void ipsdk::imaproc::arithm::cartesianToPolarImg ( const image::ImageConstPtr pInXImg,
const image::ImageConstPtr pInYImg,
const image::ImagePtr pOutRhoImg,
const image::ImagePtr pOutThetaImg 
)

wrapper function for cartesian to polar coordinates transformation

Exceptions
ipsdk::processor::IPSDKBaseProcessingExceptionon failure