IPSDK 4.1.0.2
IPSDK : Image Processing Software Development Kit
Cartesian to polar transformation
rhoImg,thetaImgcartesianToPolarImg (inXImg,inYImg)

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

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

Header file

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

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;