Message Boards Message Boards

0
|
6041 Views
|
5 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Vectorization of lines from image

Hello,

I am trying to vectorize a binary image that consists of lines. Here is a related post but the function is not published or available.

https://community.wolfram.com/groups/-/m/t/1160838

Is there a function for this available or has anyone implemented the remaining gaps?

Best,

Max

5 Replies

Hi Max,

ImageGraphics is not capable of correctly detecting and representing lines and curves. For now, there is this example under possible issues: https://reference.wolfram.com/language/ref/ImageGraphics.html#1228943616 In the future, we plan to improve/extend the function to be able to understand and better vectorize 1D shapes.

-- Shadi

POSTED BY: Shadi Ashnai
Posted 3 years ago

Have you tried ImageGraphics?

POSTED BY: Rohit Namjoshi

Hello Rohit,

I have tried ImageGraphics, but it only works for filled areas and gives as a result the outline of the area. However, I want to have a line.

See the problem here:

l = Line[{{0, 0}, {0, 1}, {1, 1}, {0, 0}}];
Graphics[l, ImageSize -> 300]
Show[ImageGraphics[Rasterize[Graphics[l, ImageSize -> 100]]], ImageSize -> 300]
Show[ImageGraphics[Rasterize[Graphics[{Thickness[0.05], l}, ImageSize -> 100]]], ImageSize -> 300]

Max

Have you tried ImageLines?

POSTED BY: Gianluca Gorni

Hi Gianluca,

oh I forgot to mention that there are curved lines too in my images.

l = {Line[{{0, 0}, {0, 1}, {1, 1}, {0, 0}}], Circle[{0.5, 0.5}, 0.5]};
i = Graphics[l, ImageSize -> 300]
Show[ImageGraphics[Rasterize[Graphics[l, ImageSize -> 100]]], ImageSize -> 300]
Show[ImageGraphics[Rasterize[Graphics[{Thickness[0.05], l}, ImageSize -> 100]]], ImageSize -> 300]
HighlightImage[i, ImageLines[ColorNegate[i], 1/3]]
HighlightImage[i, ImageLines[ColorNegate[i], 1/15]]

ImageLines only works for straight line segments, but I want a vectorization of the whole image.

Max

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract