Hi all,
How can i draw a polyline or a spline based on a raster image like the one attached? Because i have several images and i’m trying to find a way to make this tracing automated.
Thank you.
EDIT: all the images i’ve to treat have this color red lines and the background transparent.
Thank you for your reply.
I haven’t tried anything yet, because i usually draw my outlines in AutoCAD and then i import them in Revit.
I asked on purpose because I’m not practical to dynamo and maybe there is a simple command to do my task.
If my request is not clear, please let me know and i’ll try to explain it better.
Thank you @GregX I was looking for something similar, like the function ConvexHull of OpenCV. It’s ok if i have to do something in Python because the images i’ve to analize come from an automated custom object detection model written in pyhton.
Maybe to make it more flexible for Dynamo i was thinking to use a text file with all the outlines’ coordinates so, instead of tracing a raster object, Dynamo has to Draw only polylines; the only issue could be passign these coordinates in the right order, like all clockwise, and being careful to draw separated polylines for each different object.
I hope i’ve written everything correctly
I can’t remember well but when I ran my python script with opencv it exported a txt file with a list of polylines with its points coordinates, so you should just be able to read that in dynamo and do what you have to do!
Took about a minute for this small image.
Could speed the process by reducing accuracy/number of points (by increasing the value on the slider)
With the complete image, this approach may not be very efficient.
I’m trying to change my code in python and extract, instead of the raster images, the coordinates i’ve used to draw the outlines, to import them in Dynamo and use something like Point.ByCoordinates (x,y) to draw my polygons.
How should format my txt file with the coordinates to import in Dynamo and how i can cycle through the entire list of numbers to set them as coordinate x1=…; y1=…; x2=… ; y2=… ??
Thank you
Dynamo can read the csv as numbers instead of as text, saving you a bit of hassle converting and such. Then it will just be transposing the list into X and Y values and running from there.
Do the primer in its entirety, even if things feel like you won’t need them. Will save you a lot of headaches as the exercises are intended to teach the concepts in use not for the intended results.