简体   繁体   English

OpenCV:在经过处理的图像中选择轮廓

[英]OpenCV: selection of contours in a processed image

I'm a newbie in OpenCV, and I want to know if you could select a contour in a processed image, for example, you are detecting 1 circle 2 squares and 1 triangle, and you want to know the distance between the triangle and 1 square right now, so i wish to know if you can select the figures in the processed image with a mouse instance or something like that, also, change the selection, like if i want to know the distance between the circle and square or circle and triangle, something like it. 我是OpenCV的新手,我想知道是否可以在经过处理的图像中选择轮廓,例如,您正在检测1个圆,2个正方形和1个三角形,并且想知道三角形和1之间的距离现在是正方形,所以我想知道是否可以使用鼠标实例或类似的东西在处理的图像中选择图形,也可以更改选择,例如我想知道圆与正方形或圆之间的距离以及三角形,类似它。 I don't know if I've explained myself, but I would appreciate your help. 我不知道自己是否向我解释过,但感谢您的帮助。 Thanks 谢谢

Yes, it is possible (when you get there) but I'll recommend you split it into baby steps. 是的,有可能(当您到达那里时),但我建议您将其拆分为多个步骤。 This project is hard work, it will not happen in one day. 这个项目是艰苦的工作,一天之内就不会发生。 I'll recommend scaling it down initially, aiming low and only after completion, to increase the task's complexity: 我建议先将其缩小,然后再降低目标,以增加任务的复杂性:

  1. Have a circle, triangle, and square 有一个圆形,三角形和正方形
  2. Identify their contours 识别轮廓
  3. Identify the shape of each object 识别每个物体的形状
  4. Compute and print out the distance between the centroids of the square and triangle. 计算并打印出正方形和三角形的质心之间的距离。

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

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