azimuthal median [message #58026] |
Mon, 14 January 2008 05:22  |
Bringfried Stecklum
Messages: 75 Registered: January 1996
|
Member |
|
|
Hi folks,
I am looking for a faster way to compute the azimuthal median in
dependence on radius than the brute-force method, i.e. getting the index
of pixels within a certain annulus, and using median(image[idx]). Is
this another case for the histogram wizards out there?
regards,
Bringfried
|
|
|
|
Re: azimuthal median [message #58081 is a reply to message #58026] |
Wed, 16 January 2008 00:38   |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
On Tue, 15 Jan 2008 10:48:12 +0100, Wox <nomail@hotmail.com> wrote:
> On Mon, 14 Jan 2008 14:22:10 +0100, Bringfried Stecklum
> <stecklum@tls-tautenburg.de> wrote:
>
>> Hi folks,
>>
>> I am looking for a faster way to compute the azimuthal median in
>> dependence on radius than the brute-force method, i.e. getting the index
>> of pixels within a certain annulus, and using median(image[idx]). Is
>> this another case for the histogram wizards out there?
>>
>> regards,
>>
>> Bringfried
>
> I'm not familiar azimuthal median but what about image warping:
>
>
> ; Make azimuthal range
> a0=0.
> a1=2*!pi
> ai=0.1
> na=ceil((a1-a0)/ai)+1
> ai=(a1-a0)/(na-1)
> a=a0+ai*indgen(na)
>
> ; Make radial range
> r0=10.
> r1=20.
> ri=0.1
> nr=ceil((r1-r0)/ri)+1
> ri=(r1-r0)/(nr-1)
> r=r0+ri*indgen(nr)
>
> ; Radius and azimuth for warped image
> r=rebin(r,nr,na,/sample)
> a=rebin(transpose(a),nr,na,/sample)
>
> ; X and Y for warped image (xc,yc is center)
> xmap=xc+r*cos(a)
> ymap=yc+r*sin(a)
>
> ; Warped image
> oimage=Interpolate(image,xmap,ymap,/cubic)
>
> ; Median
> m=median(oimage,dim=1)
Should be m=median(oimage,dim=2) otherwise you get the median as a
function of azimuth.
|
|
|
|
Re: azimuthal median [message #58115 is a reply to message #58026] |
Tue, 15 January 2008 01:48   |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
On Mon, 14 Jan 2008 14:22:10 +0100, Bringfried Stecklum
<stecklum@tls-tautenburg.de> wrote:
> Hi folks,
>
> I am looking for a faster way to compute the azimuthal median in
> dependence on radius than the brute-force method, i.e. getting the index
> of pixels within a certain annulus, and using median(image[idx]). Is
> this another case for the histogram wizards out there?
>
> regards,
>
> Bringfried
I'm not familiar azimuthal median but what about image warping:
; Make azimuthal range
a0=0.
a1=2*!pi
ai=0.1
na=ceil((a1-a0)/ai)+1
ai=(a1-a0)/(na-1)
a=a0+ai*indgen(na)
; Make radial range
r0=10.
r1=20.
ri=0.1
nr=ceil((r1-r0)/ri)+1
ri=(r1-r0)/(nr-1)
r=r0+ri*indgen(nr)
; Radius and azimuth for warped image
r=rebin(r,nr,na,/sample)
a=rebin(transpose(a),nr,na,/sample)
; X and Y for warped image (xc,yc is center)
xmap=xc+r*cos(a)
ymap=yc+r*sin(a)
; Warped image
oimage=Interpolate(image,xmap,ymap,/cubic)
; Median
m=median(oimage,dim=1)
|
|
|
Re: azimuthal median - final remark [message #58207 is a reply to message #58079] |
Thu, 17 January 2008 02:53  |
Bringfried Stecklum
Messages: 75 Registered: January 1996
|
Member |
|
|
Another improvement is to compute the radial indices only once, and
account for the different object positions in the image by accessing the
proper index range, i.e. object_idx=idx[r]+nx_pixels*ypos+xpos.
Bringfried Stecklum wrote:
> Dear Brian and Wox,
>
> thanks to both of you. What I am doing right now is to set up an array
> which holds the radius values, and use the reverse indices returned by
> histogram (applied to the radius array) to access the data. This speeds
> up things quite a bit.
>
> with kind regards,
>
> Bringfried
|
|
|