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

Home » Public Forums » archive » Filter image with moving window and averaging pixels
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: Filter image with moving window and averaging pixels [message #52435 is a reply to message #52350] Wed, 31 January 2007 15:55 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Jan 31, 11:58 am, "rpert...@gmail.com" <rpert...@gmail.com> wrote:
> I need to filter some noise out of an image and was pointed towards
> making a moving/sliding window (size, say 7x7) and compare the center
> pixel with surrounding pixels right next to border (ignoring middle
> pixels). And compare the value of center pixel with the border average
> pixels and thus filter out noise. However, I am not sure how to do
> this.
> Anyone has any idea?

I'm not sure I'm following you, but how about this:

; read/generate your image
im = byte(randomu(seed, 200, 200) * 255)

; create a kernel with 1's on the outside edges
kernel = bytarr(7, 7) + 1B ; set everything to 1's then...
kernel[1:5, 1:5] = 0B ; set the inside to zero
print, kernel

borderAverage = convol(im, kernel, total(kernel), /edge_truncate)

You say "compare the value of center pixel with the border average
pixels" and I'm not sure what you want to do as a result of this
comparison, but the border average pixels are in borderAverage. So you
could compare borderAverage[10, 20] to im[10, 20] to compare the
border average to the image value at pixel (10, 20).

Mike
--
www.michaelgalloy.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: netCDF/CF conventions
Next Topic: Removing fields from a structure

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

Current Time: Fri Oct 10 11:28:37 PDT 2025

Total time taken to generate the page: 0.08378 seconds