1

actually,I am learning the drawing machine following google's research in this site:
https://github.com/tensorflow/magenta/tree/master/magenta/models/sketch_rnn

I want to create my own datasets,just want to convert the database in this paper to line segments, I want to convert some SVG images to line segments using the svg.path in https://pypi.python.org/pypi/svg.path, this library is given by the team of sketch_rnn. But I am not good at python , I even do not know how to read a svg image. I search some result below:

Convert a SVG image to multiple vector line segments using Python

Turn SVG path into line segments

but I dont know how to use that in this database. Can you tell me how to read the SVG image and change it to svg.path? which read function I can use?

martineau
  • 119,623
  • 25
  • 170
  • 301
Lily.chen
  • 119
  • 1
  • 8
  • What you'll need to do is read the elements from the SVG file using svg.path. Several of those elements represent curves and don't contain the line segments the make them up. In order to get those, as it says on the project page,"All of these objects have a `.point()` function which will return the coordinates of a point on the path, where the point is given as a floating point value where 0.0 is the start of the path and 1.0 is the end." This means to you will need use that get the line segments you want (by calling it over-and-over with a range of values between 0.0 and 1.0). – martineau Dec 22 '17 at 07:23
  • @martineau Thank you so much. But the svg.path does not support to read the complete SVG files. maybe that means I have to read the SVG images to path using other libraries? I will try to learn more about the SVG and path. I cant understand your words completely,but I appreciate it – Lily.chen Dec 22 '17 at 08:46
  • There's this https://github.com/mathandy/svgpathtools – Iyad Ahmed Apr 15 '22 at 18:46

0 Answers0