5

I would to know if it's possible to convert a simple bitmap to a geometry object

guillaume
  • 321
  • 1
  • 4
  • 18
  • 1
    That's not a simple process (and a quick search didn't provide any promising SDKs). Look up edge detection and raster to vector conversion. – Michael Todd Jun 14 '10 at 16:29

1 Answers1

4

Yes, you can using tracing. Potrace is an open source bitmap-to-vector tracer library.

However, bitmap tracing is imperfect; for high-quality vector image, line tracer is generally only used to do the initial tracing, which would later be hand-tweaked. Inkscape, an open source vector image editor, provides built-in support for tracing (internally using potrace).

Lie Ryan
  • 62,238
  • 13
  • 100
  • 144
  • source bitmap will be simple shape and black and white, i just need all the conversion to be automatic : people load a bitmap and i store a geomtry object , the goal is to extrude these shape to a 3d cone – guillaume Jun 14 '10 at 17:09
  • simple black and white image can be easily traced using potrace (in fact, they're the ONLY thing that can be traced, color images need to be somehow converted to black-and-white before you can trace them). – Lie Ryan Jun 14 '10 at 17:14
  • it seam that Inkscape can convert colored bitmap to vectors ... is there any way to doing that in command line – guillaume Jun 15 '10 at 21:57
  • @guillaume not with the potrace cmd line. What I've seen online is to split the rgb channels, and trace them separately. My guess is that you'd then use some kind of xml parser to get the paths of each channel, set their fills to their respective colors, set their transparency to that of the rgb color matrix (.2126 * R^gamma + .7152 * G^gamma + .0722 * B^gamma - https://stackoverflow.com/questions/687261/converting-rgb-to-grayscale-intensity) for each respective channel, ie the red channel traced paths would be filled red, with transparency value of 21.26%. – Shmack Oct 11 '21 at 22:36