简体   繁体   English

如何在执行轮廓检测后画圆

[英]How to draw circle after contour detection has been performed

I am working on the project where i first need to detect the object and make outline that covers whole object it can be seen on 1st image.我正在做一个项目,我首先需要检测 object 并制作覆盖整个 object 的轮廓,它可以在第一张图像上看到。 It was successfuly done by the contour Detection.轮廓检测成功完成。 The next thing which i want to to do is to make a circle inside the outline object.我想做的下一件事是在轮廓 object 内画一个圆圈。

How it can be done with if we have multiple objects we can do contour detection to detect and outlined it but how to draw a circle in inside of each outlined object.如果我们有多个对象,我们可以进行轮廓检测以检测和勾勒它,但如何在每个轮廓 object 内部绘制一个圆圈。

Please see attached picture.请看附图。 This contains a single object but in can be multiple also.这包含单个 object 但也可以是多个。

轮廓检测后概述

在轮廓对象内绘制圆圈

It can be achieved simply by -它可以简单地通过 -

  • First, extract the contour image (Contour filled with white colour and rest in black).首先,提取轮廓图像(用白色填充的轮廓和黑色的 rest)。
  • Then apply distance transformation on the image.然后对图像应用距离变换
  • In this distance transform matrix now, find the point having the highest value.现在在这个距离变换矩阵中,找到具有最高值的点。 This point will be the center of the circle and the corresponding distance will be the radius.该点将是圆的中心,相应的距离将是半径。

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

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