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

Home » Public Forums » archive » I think my circular median filter is very inefficient
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
I think my circular median filter is very inefficient [message #89202] Sat, 02 August 2014 20:00 Go to previous message
JRP is currently offline  JRP
Messages: 3
Registered: August 2014
Junior Member
Hi, I have written a circular median filter for removing noise from a noisy signal, which runs through a loop of radii (r=2 -> r=20) and then calculates a peak signal-noise ratio to determine which radius does well (this does not take long). I am by no means at all experienced in any kind of programming, so if anyone is able to offer me any assistance in reducing the time it would take me to do this it would be greatly appreciated! Here is the part of the median filter code:

for k=0,size3[1]-size2[1]-1 do begin
for l=0,size3[2]-size2[2]-1 do begin
for i=0, size2[1]-1 do begin
for j=0, size2[2]-1 do begin

holder[i,j] = (se[i,j]*padding[i+k,j+l])
med = MEDIAN(holder)
clean[k,l] = med

endfor
endfor

endfor
endfor

Here, size2 is the size of the circular structuring element and size3 is the size of the padded noisy image. So basically I multiply the structuring element by the noisy image (which is padded), store in the values that fill the circle, then find the median and assign it to a "cleaned" image. Then the loop moves the structuring element 1 unit over...

At the moment, the program has done up to r=17, and has been running for 7.2 hours. I've been printing the time it takes for each radii to complete and it will take something like a further 5.5 hours to complete! :(

Cheers!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Coyote Off on Colorado Adventure
Next Topic: Routines to transform vectors between map projections

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

Current Time: Wed Oct 08 13:39:08 PDT 2025

Total time taken to generate the page: 0.00378 seconds