BrachioGraph icon indicating copy to clipboard operation
BrachioGraph copied to clipboard

Creating json lines from image with image_to_json fails with error

Open lriley2020 opened this issue 3 years ago • 0 comments

Sorry in advance if I'm doing something stupid here! I've been trying to convert a png image to json to plot it, but when I import linedraw and run image_to_json, I get the following error:

>>> from linedraw import *
>>> image_to_json("imagename", draw_contours=2, draw_hatch=16, repeat_contours=3)
generating contours...
finding edges...
getting contour points...
connecting contour points...
getting contour points...
connecting contour points...
optimizing stroke sequence...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/liamriley/bg/BrachioGraph/linedraw.py", line 36, in image_to_json
    lines=vectorise(
  File "/Users/liamriley/bg/BrachioGraph/linedraw.py", line 120, in vectorise
    contours = sortlines(getcontours(
  File "/Users/liamriley/bg/BrachioGraph/linedraw.py", line 329, in sortlines
    slines = [clines.pop(0)]
IndexError: pop from empty list
>>> 

Is there an issue with the code?

lriley2020 avatar Nov 25 '22 15:11 lriley2020