comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Mapping image into a polar-square coordinate
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Mapping image into a polar-square coordinate [message #61183 is a reply to message #61182] Wed, 09 July 2008 12:43 Go to previous messageGo to previous message
jschwab@gmail.com is currently offline  jschwab@gmail.com
Messages: 30
Registered: December 2006
Member
> yeah, but i dont know how to extract a rectangular matrix which rows
> are radius and columns are angles

Paolo's suggestion of bilinear is a good one.

The best thing to do is construct a polar coordinate system and then
transform that into a rectangular system that is equivalent to your
pixel indices.

Suppose there is a rectangular coordinate system, centered on the
middle pixel of your 981 x 981 data. Then if we want to extract the
annulus which is between 100 and 200 pixels from the center, we could
do something like this.

-----

image: 981 x 981 (same as your ``data'' array)
new_image: 4096 x 10

;; first construct the equivalent polar coordinates

min_r = 100.0
max_r = 200.0

;; this is theta = [0, 2*pi)
new_th = rebin(dindgen(4096) / 4096d * (2d * !dpi), 4096, 10)

;; this is r = [r_min, r_max]
new_r = rebin(transpose((max_r - min_r) * dindgen(10) / 9d + min_r),
4096, 10)

;; now convert to rectangular coordinates
;; and shift such that the origin lies not at the center
;; but at image[0,0]

new_x = new_r * cos(new_th) + 490.0
new_y = new_r * sin(new_th) + 490.0

;; new_x and new_y are fractional pixel coordinates
;; use bilinear to extract the values

new_img = bilinear(image, new_x ,new_y)

-----

Hope that helps,
Josiah
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: about READ_ASCII format and PRINT a double array
Next Topic: Re: SHA-1, MD5, etc inquiry

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:59:26 PDT 2025

Total time taken to generate the page: 0.00214 seconds