Path: news.mathworks.com!newsfeed-00.mathworks.com!NNTP.WPI.EDU!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: Converting raster graphics into vector graphics in matlab
Date: Fri, 4 Jul 2008 20:32:00 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 35
Message-ID: <g4m1c0$caj$1@canopus.cc.umanitoba.ca>
References: <557f2ef2-62a8-422a-8468-5d766fd1ff78@k37g2000hsf.googlegroups.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1215203520 12627 192.70.172.160 (4 Jul 2008 20:32:00 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Fri, 4 Jul 2008 20:32:00 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:477600



In article <557f2ef2-62a8-422a-8468-5d766fd1ff78@k37g2000hsf.googlegroups.com>,
 <abe.cool@gmail.com> wrote:

>I just want to convert bitmap image in to vector format by using
>MATLAB, If u knw pls reply me with the answer

Yeh, I've done that, in Fortran years ago, and more recently
in Maple and in Matlab. It isn't a difficult process, but it is
common for the fine details to get messed up in the first few
iterations of writing the code, at least if you write it iteratively
instead of recursively.

Probably the easiest way to do it iteratively is to use the "left-hand
rule" (or the "right-hand rule") for maze-solving: find an edge and
follow it around, always checking for possible turns in counter-clockwise
(or clockwise) sequence. Each time you proceed in the same direction
you were already going, just keep track of where you started this
segment and where you are now; each time you change direction,
write out the vector between the old starting point and the current
location and record the current location as the new base of movement.
Oh yes, and as you pass through a point, mark that point has having
been travelled through in an auxillary matrix. When you complete a
circuit (get back to where you started the current trip), scan
through the auxillary matrix to find another location that is
beside one that has been already visitied, but which hasn't been
visited yet.

The logic can, if you prefer, be divided into two parts, one part
where you track pixel locations on the path, and the other part
that analyzes the completed path to minimize the turns.

I haven't described here the logic for dealing with blobs of
colour; the extension of the logic is not very difficult.
-- 
   "Okay, buzzwords only. Two syllables, tops."  -- Laurie Anderson