简体   繁体   English

如何使用图像处理库 opencv 和 python 语言提取材料的轮廓(2D 绘图)?

[英]How to extract the contour of a material (2D drawing) with the image processing library opencv and python language?

  • link: technical image链接:技术图片
  • The picture shows a technical drawing of a material.图为材料的技术图纸。 I have to contour this material with opencv python.我必须用 opencv python 对这种材料进行轮廓处理。 The lines with a large thickness are the lines of the material.粗细的线条是材质的线条。 But if 3 small lines (indicating length, diameter) join, there is a material line and this is my problem.但如果 3 条小线(表示长度、直径)连接,则有一条材料线,这是我的问题。 Thanks for your help.谢谢你的帮助。

I'm assuming you're doing something like this.我假设你正在做这样的事情。

edges = cv2.Canny(gray, 50, 150)
_, contours, hierarchy = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) 

You can increase the canny thresholds to only have thick edges.您可以增加精明阈值以仅具有厚边缘。

edges = cv2.Canny(gray, 100, 300)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM