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

Home » Public Forums » archive » Re: Blanking all 5x5 windows with less than X 'on' pixels in them
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: Blanking all 5x5 windows with less than X 'on' pixels in them [message #74540 is a reply to message #74539] Fri, 21 January 2011 02:52 Go to previous messageGo to previous message
Axel Martínez is currently offline  Axel Martínez
Messages: 22
Registered: June 2010
Junior Member
On Jan 21, 11:41 am, Axel M <axe...@gmail.com> wrote:
> On Jan 21, 10:02 am, Robin Wilson <ro...@rtwilson.com> wrote:
>
>
>
>> Hi Chris,
>
>> That's great. Yes, your description is correct - that's exactly what I
>> want to do.
>
>> Cheers,
>
>> Robin
>
>>> Hi Robin,
>>> i have such a vectorised function. Please give more details. Do you
>>> want to clean all pixels including the center pixel in a moving
>>> window, if the center pixel is below a threshold?
>
>>> Cheers
>
>>> CR
>
> Hi Robin,
>
> You described the problem in two different ways:
> (1) clean the pixel neighborhood if the center pixel is below a
> threshold
> (2) clean the pixel if the number of neighbors on is below a threshold
>
> I understand that you actually mean case (2). You can try that (I did
> not test the code):
> kernel_size = 9
> threshold = 3.0 / (kernel_size*kernel_size) ;3 pixels on out of a 9x9
> neighborhood
> Image[WHERE(SMOOTH(image, [kernel_size,kernel_size], /EDGE_TRUNCATE)
> LT threshold)] = 0

A correction: if image is not a float array, please change it like
that:
Image[WHERE(SMOOTH(FLOAT(image), [kernel_size,kernel_size], /
EDGE_TRUNCATE) LT threshold)] = 0

If you want the code to be robust, you should also check that WHERE is
not -1.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: FSC_contour & NaN
Next Topic: Making a 64 bit DLM

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

Current Time: Sat Oct 11 09:53:43 PDT 2025

Total time taken to generate the page: 7.20003 seconds