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

Home » Public Forums » archive » Image thresholding
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: Image thresholding [message #15455 is a reply to message #15382] Tue, 18 May 1999 00:00 Go to previous messageGo to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
Liam Gumley, Liam.Gumley@ssec.wisc.edu writes:

> With all due respect to my esteemed colleagues
> David Kastrup and David Fanning, I believe the
> fastest method is as follows:
>
> ((a lt 5) or (a gt 10)) * a


Speed is hard to pin down, and I appreciate the august company I
am keeping here, so I won't make any absolutist remarks. However, for
my sort of data on my sort of machines the HISTOGRAM function usually
works as well as or better than direct comparisons:

a = indgen(100)
hist = histogram(a, reverse_indices=r)
a(r(r(5):r(10)-1)) = 0

This is especially good for things like interactive image
thresholding because you only need to calculate the histogram once.
Also, as your datasets get larger you start to save significant
amounts of memory, since the histogram is usually much smaller than
the comparison arrays. For arbitrary data with an unknown maximum or
minimum value, there is a danger that you reference elements of the
reverse_indices array which don't exist (try the above with
a=indgen(10)), but cunning use of the BINSIZE, MAX and MIN keywords
usually solves the problem.

For one-time use further speed gains can be had by only
constructing the histogram for the data range you are interested
in, viz:

a = indgen(100)
hist = histogram(a, min=5, max=10, reverse_indices=r)
a(r(r(0):r(5)-1)) = 0


Struan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL(rsi) + FORTRAN(digital) + DLL(windows nt)
Next Topic: behavior of arrays

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

Current Time: Sat Oct 11 18:01:17 PDT 2025

Total time taken to generate the page: 1.91929 seconds