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

Home » Public Forums » archive » Kuwahara Filter
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Kuwahara Filter [message #29420] Thu, 14 February 2002 15:07
Joshua Nipper is currently offline  Joshua Nipper
Messages: 8
Registered: February 2002
Junior Member
Hi there, I'm trying to implement the kuwahara filter, and can't seem to
figure out how to get around using for loops, making it very slow. Can
anyone suggest a way to speed this up?
Thanks,
Josh Nipper


function kuwahara,input,kernelsize
T=systime(1)
s=size(input,/dimensions)
temp=bytarr(s)
identity=intarr(kernelsize)+1
M=indgen(kernelsize)-(kernelsize/2)
mX=M#identity
my=-identity#M
for i=0,s[0]-10 do begin
for j=0,s[1]-10 do begin
xpoint=j
ypoint=i
region1=input[(xpoint-1)+mX,(ypoint+1)+mY]
region2=input[(xpoint+1)+mX,(ypoint+1)+mY]
region3=input[(xpoint-1)+mX,(ypoint-1)+mY]
region4=input[(xpoint+1)+mX,(ypoint-1)+mY]

var=[variance(region1),variance(region2),variance(region3),v ariance(region4)
]
avg=fix([mean(region1),mean(region2),mean(region3),mean(regi on4)])
location=where(var EQ min(var))
temp[xpoint,ypoint]=avg[location]
endfor
endfor
PRINT, SYSTIME(1) - T, 'Seconds'
return,temp

end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: DIALOG_PRINTJOB and DIALOG_PRINTERSETUP
Next Topic: solution of linear equations

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

Current Time: Thu Oct 09 22:58:05 PDT 2025

Total time taken to generate the page: 0.47956 seconds