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

Home » Public Forums » archive » An algorithm puzzle
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
An algorithm puzzle [message #60788] Fri, 13 June 2008 20:43 Go to previous message
Y.T. is currently offline  Y.T.
Messages: 25
Registered: December 2004
Junior Member
Imagine there's a byte-array named "P" that contains only zeros and
ones:

IDL> help,p
P BYTE = Array[5000, 4250]
IDL> print,n_elements(where(p eq 0 or p eq 1))
21250000
IDL> print,5000L*4250
21250000

I am trying to construct a new (lon)array "D" with the same dimensions
as "P" with the following properties:

If P[x,y] eq 0 then D[x,y] = 0 (this part is easy)
If P[x,y] eq 1 then D[x,y] = the smallest distance between {x,y} and a
point in P that is equal to 0

In essence I'd like to know how far each non-zero "pixel" in p is from
a place that is zero (so that I can do statistics on the frequency of
certain distances and such).

I'm currently brute-forcing it with two for-loops where I calculate
the distance between every single element and every single "other"
element and then finding the minimum. Needless to say this takes about
a metric forever and I figured you folks usually have really clever
ideas so I'm throwing this out here to see whether there isn't some
obscure usage of histogram that does exactly what I want...


cordially

Y.T.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Hierarchical Splitting of images based on texture
Next Topic: Re: Image proceesing in IDL

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

Current Time: Sun Oct 12 01:17:26 PDT 2025

Total time taken to generate the page: 1.66164 seconds