1

Possible Duplicate:
Sourcecode to convert JPG (bitmap) to SVG (vector)?

Is there an existing php library that can do an image trace function? If not, how would this be accomplish-able? Is there an existing library that could be easily ported to php?

Community
  • 1
  • 1
19greg96
  • 2,592
  • 5
  • 41
  • 55
  • This is a very hard CS problem to tackle oneself. What has your research/web-searching turned up in the way of libraries thus far? – halfer Apr 22 '12 at 09:09
  • this: http://potrace.sourceforge.net/ and this https://github.com/PowerflasherBR/as3potrace but none of them is in php – 19greg96 Apr 22 '12 at 09:17
  • 1
    They don't need to be written entirely in PHP - just for there to be a way to interface to them using PHP. Often you can just interface with this sort of thing on the command line, and generate SVG output to a file. – halfer Apr 22 '12 at 09:18

2 Answers2

0

Just found this, which is a tutorial on tracing a bitmap in Inkscape. You might have to dig about in the internals of the program to be able to interface it in PHP, but perhaps that might get you started?

Edit: this uses Potrace internally, which I suspect works at the command line. Image in, SVG/PDF out - easily interfaced in PHP.

halfer
  • 19,824
  • 17
  • 99
  • 186
0

You can use OpenCV's feature detection functionality to detect and trace edges. OpenCV is very good at these type of image processing and is widely used and developed.

There is also a PHP library to interface with OpenCV.

F21
  • 32,163
  • 26
  • 99
  • 170