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

Home » Public Forums » archive » Re: Compute Euclidean distances
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: Compute Euclidean distances [message #54141] Fri, 25 May 2007 07:50
cmancone is currently offline  cmancone
Messages: 30
Registered: May 2007
Member
On May 25, 3:46 am, "lbus...@yahoo.it" <lbus...@yahoo.it> wrote:
> 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

hmm... I'm afraid I don't have time for a long winded response at the
moment, but I can give you a possibly useful reference. I was trying
to solve a very similar problem myself recently, and you can read the
discussion here:

http://groups.google.com/group/comp.lang.idl-pvwave/browse_t hread/thread/629cbb2a852c5371/6ada6d1659bc55a7?hl=en#6ada6d1 659bc55a7

I was trying to match up two lists of stars (x&y positions for both
lists). I wanted to find the closest star in list one to each star in
list two. In order to do that, I first had to calculate distances
between each star, which is exactly what you want. So, that
discussion (and the links in it) should give you a good idea of where
to get started.
[Message index]
 
Read Message
Previous Topic: Re: From C to IDL questions
Next Topic: request...

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

Current Time: Fri Oct 10 07:27:44 PDT 2025

Total time taken to generate the page: 1.04020 seconds