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

Home » Public Forums » archive » Re: creating a 2D mask for image filtering
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: creating a 2D mask for image filtering [message #77212 is a reply to message #77211] Wed, 17 August 2011 06:11 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dave Higgins writes:

> I need to create a 2D mask to filter data in the frequency domain
> (apodization). I would like to leave 0.8 of the centre-to-edge of the
> data untouched (i.e. a circle of untouched data), and then a Hanning-
> type shape to smooth down to zero at the edges. (Think of an upside-
> down frying pan, kinda.) I can apply a Hanning filter with
>
> apod_fn = HANNING(kx_res, ky_res, alpha=0.5)
>
> but of course the centre area which I would like to have untouched
> doesn't exist, and the filter is too aggressive. I'd go without the
> Hanning shape requirement if I could get more-or-less the right shape.
> I see also DIGITAL_FILTER, but can't seem to widen the filter with my
> changes to it's arguments.
>
> Thanks for any pointers.

I would construct your filter something like this:

s = Size(image, /Dimensions)
hf = Hanning(s[0], s[1], ALPHA=0.5)
thisDevice = !D.Name
Set_Plot, 'Z'
Device, SET_RESOLUTION=s, SET_PIXEL_DEPTH=8, DECOMPOSED=0
Erase, COLOR=0
maxRadius = Max(s)/2
TVCircle, maxRadius*0.8, s[0]/2, s[1]/2, COLOR=1, /FILL
circleMask = TVRD()
Set_Plot, thisDevice
indices = Where(circleMask EQ 1)
hf[indices] = 1
cgSurface, hf
END

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Unable to get GRIDDATA Function to Work Properly
Next Topic: difficulty using "linterp" command - need help making loop to exclude a value yet average others

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

Current Time: Thu Oct 09 07:47:57 PDT 2025

Total time taken to generate the page: 0.47897 seconds