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

Home » Public Forums » archive » Re: In Praise of HISTOGRAM
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: In Praise of HISTOGRAM [message #30247] Sat, 13 April 2002 06:43
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning (david@dfanning.com) was dumb enough to
write the other day:

> Hang on a minute! What if we create an integer array, put
> one image in the low bits and the other image in the high
> bits. Won't each pixel have a unique number value? Then,
> what if we take a histogram of that? Won't that give us
> a vector of 2^16-1 values? And what if we reform that
> into the 256 by 256 array we are looking for?

Uh, it was pointed out to me that HIST_2D was doing
this since about 1938 or so. I feel a bit like Columbus
re-discovering the New World. :-(

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: In Praise of HISTOGRAM [message #30251 is a reply to message #30247] Fri, 12 April 2002 11:44 Go to previous message
G Karas is currently offline  G Karas
Messages: 12
Registered: March 2002
Junior Member
that sounds very interesting david.
i have been busy with images and histograms
for a very long time now.. and sometimes IDL
crushes on me, because of 'out of memory' probs..

i will try your solution with this one, might help :)

thanks for the excellent tip!

"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1720c0a738f663b898988a@news.frii.com...
> Folks,
>
> I used to think the WHERE function was pretty neat. But
> lately (I.e., this morning) I have become a convert and
> sing in praise of the HISTOGRAM function.
>
> I had as a task to compute a density plot from two
> images. This is a pixel-wise comparison in which the
> X axis contains the values of image 1 (0 to 255) and the Y axis
> contains the values of image 2 (0 to 255). The Z direction of the
> plot contains the number of times these two images have this same
> pair-wise relationship. In other words, if the pixel value of image 1
> is 10 and the pixel value of image 2 is 20, how many pixels are
> there that have 10 in image 1 and 20 in image 2.
>
> Because I had never done this before, I proceeded in my
> usual plodding way. My first attempt (which I thought was
> pretty slick) computed histograms of the two images and
> used reverse indices to obtain the indices of the images
> that contained a particular value. Then I did a set intersection
> between the two vectors of indices to find out how many were
> in common. This method took only 48 minutes on these rather
> large (2199 x 2380) images. :-(
>
> Oh, dear. I heard that ENVI did this sort of think almost
> instantaneously. Didn't *anyone* download that SAVE file
> cracker of Craig's!?
>
> My colleague, Dave Burridge, and I put our heads together.
> There must be a trick to be discovered here.
>
> Hang on a minute! What if we create an integer array, put
> one image in the low bits and the other image in the high
> bits. Won't each pixel have a unique number value? Then,
> what if we take a histogram of that? Won't that give us
> a vector of 2^16-1 values? And what if we reform that
> into the 256 by 256 array we are looking for?
>
> Wham, bam. Less than 0.3 seconds later there was the
> result! If that first time through hadn't have taken
> 48 minutes I wouldn't have believed it.
>
> I don't know if I've ever said this before, but I
> LOVE IDL!
>
> 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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: basic soubt with fltarr
Next Topic: Re: Finding the Non-Matching elements in two vectors

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

Current Time: Wed Oct 08 17:25:30 PDT 2025

Total time taken to generate the page: 0.00460 seconds