Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to add angled parts to a graph as points? #25

Open
ghost opened this issue Oct 24, 2022 · 2 comments
Open

Is it possible to add angled parts to a graph as points? #25

ghost opened this issue Oct 24, 2022 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 24, 2022

Hello. I found this package to make floorplan Binary Image to graph like this.
room
I make it to skeleton image and result is here.
room2
room3
Is it possible to add angled parts where i pointed by arrows to a graph as points?

also ,I wish the graph was composed only of straight lines... is any options?

@yxdragon
Copy link
Member

this should be a post process. sknw transform image to vector graph, then you can use some geometry lib (such as shape ly) to simplify the edge.

@yxdragon
Copy link
Member

this is a demo generated by chatgpt, It seems ok, but I did not test it

from shapely.geometry import LineString, Point

# Define a line string
line = LineString([(0, 0), (0, 1), (1, 1), (2, 2), (3, 1), (4, 0)])

# Simplify the line string with a tolerance of 0.5
simplified_line = line.simplify(tolerance=0.5, preserve_topology=False)

# Print the original and simplified line strings
print("Original line: ", line)
print("Simplified line: ", simplified_line)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant