Skip to content

Creating json lines from image with image_to_json fails with error #124

@lriley2020

Description

@lriley2020

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions