Thread Subject: Converting raster graphics into vector graphics in matlab

Subject: Converting raster graphics into vector graphics in matlab

From: abe.cool@gmail.com

Date: 4 Jul, 2008 19:24:47

Message: 1 of 4

Hi Guys,

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

Thank You

Abethan

Subject: Converting raster graphics into vector graphics in matlab

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 4 Jul, 2008 20:32:00

Message: 2 of 4

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

Subject: Converting raster graphics into vector graphics in matlab

From: abe.cool@gmail.com

Date: 27 Aug, 2008 18:46:09

Message: 3 of 4

Well, we have tried another algorithm.and we did it.thank you for your
interest.But it is getting 3 seconds to vectorize an image.I just want
to know how efficient your algorithm is and please let me know the
time it's taking for converting a raster image to the vector image.And
please tell me does Matlab support something like threads in othe
languages(eg: Java,C#).
Thank you

Subject: Converting raster graphics into vector graphics in matlab

From: Walter Roberson

Date: 28 Aug, 2008 16:42:04

Message: 4 of 4

abe.cool@gmail.com wrote:
> Well, we have tried another algorithm.and we did it.thank you for your
> interest.But it is getting 3 seconds to vectorize an image.I just want
> to know how efficient your algorithm is and please let me know the
> time it's taking for converting a raster image to the vector image.

Sorry, I did not do any timing tests. My machine spent far more time
-displaying- the vectorized image than computing the vectorized image.

I have looked around my files a bit, and it appears I might have been
mistaken about having implemented the code in Matlab; at the time
I wrote the posting, I thought that I had done a Matlab port. The port
I have for sure is in Maple, and uses enough Maple features that Maple 11
is not happy to convert the code to Matlab code automatically
(in particular, it has a hard time converting the Matrix constructor
that I compute the array limits for.) It would not be very difficult
to port the code to Matlab (everything it uses in Maple has Matlab
analogs), but it appears I did not have a reason to do so. I do have
Maple 12 available on a different machine and the conversion of Maple
to Matlab is said to be noticeably better in Maple 12, but I haven't had
a chance to give it a trial whirl (and for whatever reason the network
between the two machines was very slow yesterday.)

> And
> please tell me does Matlab support something like threads in othe
> languages(eg: Java,C#).

With the Distributed Computing Toolbox or Distributed Computing Engine
it does. I have not investigated the extent to which one can get
meaningful access to Java threads from Matlab. Based upon what I have
read before in this newsgroup about Java threads, there are significant
restrictions on rendering (must all be done by one specific Java thread)
and on synchronizing data structures between java threads and Matlab.

--
Q = quotation(rand);
if isempty(Q); error('Quotation server filesystem problems')
else sprintf('%s',Q), end

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com