开发者

Cartesian to log polar coordinate conversion

Hi I am trying to develop a java code that performs feature extraction in an image. I extracted the keypoints from the image. The next step is to divide the region around each keypoint into non overlap开发者_开发百科ping regions using log polar coordinate system. I browsed for the code to convert cartessian coordinates to log polar but i got the code in matlab only. I need java code. Can anyone help me


The explanation is very straightforward in the Wikipedia article: http://en.wikipedia.org/wiki/Log-polar_coordinates.

class Polar
{
    public double rho;
    public double theta;

    public void ToPolar(double x, double y)
    {
         rho = Math.log(Math.sqrt(x*x + y*y));
         theta = Math.atan2(y, x);
    }
}

Add anything else you need, but it's nothing special and it's very trivial to write. The above assumes your log is base e, and you're working in radians.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜