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

Home » Public Forums » archive » Re: Variance in sub-sections?
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
Re: Variance in sub-sections? [message #29376] Mon, 18 February 2002 13:04
Joshua Nipper is currently offline  Joshua Nipper
Messages: 8
Registered: February 2002
Junior Member
Regardless of who understands what, I'd like to say "Thank you" to everyone
who has helped. I got the filter I wanted running much faster (from 48
seconds to 0.3). I'm sure it could be faster still, but it's good enough
for me.
--Josh Nipper

PS... Mr. Fanning, Thank you so much for maintaining such an informative
website. I've had to teach myself IDL over the past year, and I've used
your site extensivly. It's always the first place I check for answers to
any questions I have. Thanks again,
Josh
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.16daf64f5f49844c98980d@news.frii.com...
> Jaco van Gorkom (j.c.van.gorkom@fz-juelich.de) writes:
>
>> P.S.: As for the /POPULATION_ESTIMATE keyword, I am afraid
>> that thread only served to increase my confusion...
>
> I'll offer a little insight into how to read between
> the lines of any article you find on the Coyote site.
> If a specific individual is mentioned in the article,
> there is a very good chance I don't understand what
> the hell he is saying either, and I am trying to
> shift responsibility for answering questions about
> it to the appropriate person. See, for example, any
> article with "histogram" in its title.
>
> Cheers,
>
> David
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
Re: Variance in sub-sections? [message #29378 is a reply to message #29376] Mon, 18 February 2002 10:31 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jaco van Gorkom (j.c.van.gorkom@fz-juelich.de) writes:

> P.S.: As for the /POPULATION_ESTIMATE keyword, I am afraid
> that thread only served to increase my confusion...

I'll offer a little insight into how to read between
the lines of any article you find on the Coyote site.
If a specific individual is mentioned in the article,
there is a very good chance I don't understand what
the hell he is saying either, and I am trying to
shift responsibility for answering questions about
it to the appropriate person. See, for example, any
article with "histogram" in its title.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Variance in sub-sections? [message #29379 is a reply to message #29378] Mon, 18 February 2002 10:12 Go to previous message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.16dadbebbee0f1e398980c@news.frii.com...
> I just now wrote up a little synopsis of this thread,
> and fixed a couple of grammatical and coding errors
> in the IMAGE_VARIANCE program. Naturally, if I completely
> obliterated Martin's inimitable style, I want to hear
> about it. :-)

Funny, only a few hours ago that Coyote search engine apologized
to me for not finding any tips on variance. Nice work, this is what I
call instant service!
Jaco

P.S.: As for the /POPULATION_ESTIMATE keyword, I am afraid
that thread only served to increase my confusion...
Re: Variance in sub-sections? [message #29381 is a reply to message #29379] Mon, 18 February 2002 08:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jaco van Gorkom (j.c.van.gorkom@fz-juelich.de) writes:

> Martin Downing once posted a nifty routine IMAGE_VARIANCE to the group.
> Look up a thread called "efficient kernel or masking algorithm ? UPDATE"
> on Google.
> http://groups.google.com/groups?hl=en&q=variance+kernel& amp;meta=group%3Dcomp.la
> ng.idl-pvwave
>
> Things should then be as simple as
> variance = IMAGE_VARIANCE(image, 1, MEAN=mean) .

I just now wrote up a little synopsis of this thread,
and fixed a couple of grammatical and coding errors
in the IMAGE_VARIANCE program. Naturally, if I completely
obliterated Martin's inimitable style, I want to hear
about it. :-)

You can find it here:

http://www.dfanning.com/math_tips/variance.html

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Variance in sub-sections? [message #29383 is a reply to message #29381] Mon, 18 February 2002 07:41 Go to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
Joshua Nipper wrote:

> I have a 512x512 image, and I would like to calculate the mean/variance
> in a 3x3 neighborhood around every pixel. What would be the easiest way
> to do this w/out for loops?

For the mean, you can use smooth() : m = smooth( img, 3 ).
Or using convol:
k = ( intarr( 3, 3 ) + 1 ) / 9.0 ; 3x3 kernel, all elements set to 1/9
m = convol( img, k )

The variance is total( (x_mean-x_i)^2 ) / n, so just subtract the mean
image, square all elements, and use convol() to sum up 3x3 local pixels
around each element:

v = convol( (img-m)^2, k )

Alex
--
Alex Schuster Wonko@netcologne.de
alex@pet.mpin-koeln.mpg.de
Re: Variance in sub-sections? [message #29385 is a reply to message #29383] Mon, 18 February 2002 06:04 Go to previous message
Jaco van Gorkom is currently offline  Jaco van Gorkom
Messages: 97
Registered: November 2000
Member
"Joshua Nipper" <nipperjc@ufl.edu> wrote in message
news:a4jph3$qdi$1@spnode25.nerdc.ufl.edu...
> I have a 512x512 image, and I would like to calculate the mean/variance in
a
> 3x3 neighborhood around every pixel. What would be the easiest way to do
> this w/out for loops?

Martin Downing once posted a nifty routine IMAGE_VARIANCE to the group.
Look up a thread called "efficient kernel or masking algorithm ? UPDATE"
on Google.
http://groups.google.com/groups?hl=en&q=variance+kernel& amp;meta=group%3Dcomp.la
ng.idl-pvwave

Things should then be as simple as
variance = IMAGE_VARIANCE(image, 1, MEAN=mean) .

Jaco

PS: I posted without thinking too much on Friday, in response to your
Kuwahara filter post. The variance I suggested was calculated with respect
to a 'sliding' mean value, and probably not a very good choice for this
kuwahara thingie.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: broken country borders in map_continents
Next Topic: Re: debug IDL DLM in Visual C++

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

Current Time: Wed Oct 08 17:34:48 PDT 2025

Total time taken to generate the page: 0.00749 seconds