开发者

Writing a script or program that "Traces" lines of an image

开发者 https://www.devze.com 2023-02-22 01:20 出处:网络
I\'d like to build a small application or script that will take an image as input and output the information for creating a graph (coordinates, vertices, edges, etc.). I\'d like to be able to just dro

I'd like to build a small application or script that will take an image as input and output the information for creating a graph (coordinates, vertices, edges, etc.). I'd like to be able to just drop blue dots on an image where a "vertex" would be and draw red lines along the pat开发者_开发技巧hs to be edges. So I was wondering if anyone had any language/library suggestions for tracing along lines of an image? I realize I probably could do this with almost any language, but does anyone have suggested language for such a problem?


Your first step would be to extract edge information from the image using Canny Edge Detector. Then, you would look for lines (curves, etc) within the edge information. The Hough transform is useful for this task. This will give you the edges you want for your graph. By finding the intersections between the edges, you can find the vertices.

You're right in saying that this can be done in any language. Just pick the one you're most comfortable with and Google around for the required libraries. Personally, I use Python and OpenCV for this sort of stuff.

Finally, what you're asking for seems to be related to raster image vectorization. You may want to Google around for that, as there are already technologies that perform that task.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号