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

Home » Public Forums » archive » Compute Euclidean distances
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
Compute Euclidean distances [message #54151] Fri, 25 May 2007 00:46 Go to next message
lbusett@yahoo.it is currently offline  lbusett@yahoo.it
Messages: 30
Registered: February 2006
Member
Hi all,

I have the following problem: given an image of about 700000
pixels, i need to calculate the distance between each pixel and about
150 points of known coordinates. Actually, I'm actually using a simple
for loop like that:


; map_x = array of east coordinates of each pixel (n =
700000)
; map_y = array of north coordinate of each pixel (n
= 700000)
; east = array of east coordinates of the each point
(n= 150)
; north = array of north coordinates of the each
point (n= 150)
; dist_pt ="results" array (n = 700000*150)
;
for point= 0, n_points-1 do begin

dist_x = (map_x - East [point])^2
dist_y =(map_y - North [point])^2
dist_pt [*,point] = sqrt ( dist_x + dist_y)

endfor

but the processing is quite slow (more than one minute on my PC), so
i'd like to ask you if there is a way to increase the speed of the
process.

Thanks in advance for the help,

Lorenzo Busetto
Re: Compute Euclidean distances [message #54190 is a reply to message #54151] Tue, 29 May 2007 00:40 Go to previous message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
Are you sure you want all those values? Do you use every one of them?
It might be faster and more elegant to calculate them on demand.

many greetings,
Greg
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Bottom of GUI not visible
Next Topic: X Windows

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

Current Time: Wed Oct 08 13:32:26 PDT 2025

Total time taken to generate the page: 0.01180 seconds