Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!24g2000hsh.googlegroups.com!not-for-mail
From: ImageAnalyst <imageanalyst@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Distance from coast map
Date: Tue, 20 May 2008 04:39:59 -0700 (PDT)
Organization: http://groups.google.com
Lines: 30
Message-ID: <57b7c4af-4281-4966-b5b8-46c514960f90@24g2000hsh.googlegroups.com>
References: <1211273718.794911@irys.nyx.net>
NNTP-Posting-Host: 75.186.67.199
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1211283600 11986 127.0.0.1 (20 May 2008 11:40:00 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 20 May 2008 11:40:00 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: 24g2000hsh.googlegroups.com; posting-host=75.186.67.199; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 
Xref: news.mathworks.com comp.soft-sys.matlab:469444


On May 20, 4:55=A0am, Francis Burton <fbur...@nyx.net> wrote:
> Suppose you have a vector of coordinates listing points around
> the coastline of a country - or simply the borders of an inland
> country. If you wanted to make a map (contour or heatmap) showing
> the minimum distance of any point location from the coast/border,
> what would be your approach to solving this problem in MATLAB?
> I can think of a couple of 'obvious' ways: 1) construct a grid
> of points and for each point do a bisection search for the radius
> at which a circle centred on the point intersects the lines that
> define the border, and 2) progressively dilate an image of the
> coastline, assigning a distance measure (which would be mapped
> to colour) at each iteration. The second method would likely be
> much faster, but also less accurate because of truncations to
> 'pixel distance'. Are there better approaches?
>
> I realize this is not a MATLAB-specific question, although I will
> implement the solution in MATLAB. (Also, this is *not* homework!)
>
> Looking forward to any suggestions or discussion.
>
> Francis

----------------------------------------------------
MATLAB's been there and done that - you're right.  What you want to do
is to create a binary image of your map.  Perhaps if you have the
boundary, you can use the poly2mask() function.  Then simply call the
bwdist function.  This is their strange name for the concept which is
more generally called the "Euclidean Distance Map."
Regards,
ImageAnalyst