examples to convert image to polar coordinates do it explicitly - want a slick matrix method
- 阅读更多 关于 examples to convert image to polar coordinates do it explicitly - want a slick matrix method
I am trying to convert an image from cartesian to polar coordinates. I know how to do it explicitly using for loops, but I am looking for something more compact. I want to do something like: [x y] = size(CartImage); minr = floor(min(x,y)/2); r = linspace(0,minr,minr); phi = linspace(0,2*pi,minr); [r, phi] = ndgrid(r,phi); PolarImage = CartImage(floor(r.*cos(phi)) + minr, floor(r.sin(phi)) + minr); But this obviously doesn't work. Basically I want to be able to index the CartImage on a grid. The polar image would then be defined on the grid. given a matrix M (just a 2d Gaussian for this example