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 #52422 is a reply to message #52350] Thu, 01 February 2007 08:13 Go to previous messageGo to previous message
rpertaub@gmail.com is currently offline  rpertaub@gmail.com
Messages: 43
Registered: January 2007
Member
Thank you for the responses!! Really great to know I am not alone as I
learn my way thru this language!

Anyway, I ended up doing a some arithmetic to find neighboring pixels
and used a couple of for loops to go through all the pixels in the
image.(still need to add a border to image to get all these pixels)!!
It is not very elegant, but once I have everything working, I might go
back and make it more elegant with the kernel and convol function
which I am
still trying to grasp does exactly!


w=2 ;width of buffer pixels
for j=2,(imagesize[0]-1-w) DO BEGIN
for i=2,(imagesize[1]-1-w) DO BEGIN

centervalue=N[i,j]
print,"Center Value is ",centervalue

topH=N[(i-w):(i+w),(j-w):(j-w)]
sum1=total(topH)
ele1=N_elements(topH)

rghtside=N[(i+w):(i+w),(j-w+1):(j+w)]
sum2=total(rghtside)
ele2=N_elements(rghtside)

BtmH=N[(i-w):(i+w-1),(j+w):(j+w)]
sum3=total(BtmH)
ele3=N_elements(BtmH)

Lftside=N[(i-w):(i-w),(j-w+1):(j+w-1)]
sum4=total(Lftside)
ele4=N_elements(Lftside)

Average=float((sum1+sum2+sum3+sum4)/(ele1+ele2+ele3+ele4))
print, "Total Average is ",average
ratio = float(average/centervalue)
print,"Ratio is average of border divided bycenter",ratio

endfor
endfor
[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: Sun Oct 12 08:47:06 PDT 2025

Total time taken to generate the page: 0.95954 seconds