简体   繁体   English

使用OpenCV从图像中提取椭圆(或斑点)

[英]Extract ellipse(or blob) from an image using OpenCV

I processed an Image to get the image below. 我处理了一张图片,得到下面的图片。 在此处输入图片说明

The lines indicates the ellipses(blobs) to be extracted. 线表示要提取的椭圆(斑点)。

I tried cv::findContours function, but the borders extracted together. 我尝试了cv :: findContours函数,但是边界一起提取了。 Please someone help me with my job. 请有人帮我工作。 Thank you. 谢谢。

I would start by extracting the first/smallest circle, and I would do it like that: 我将从提取第一个/最小的圆圈开始,然后这样做:

  1. basic thresholding to get a binary image. 基本阈值以获得二进制图像。
  2. Centroid computation 重心计算
  3. For each path between the centroid and the image border, find the closest non null pixel from the centroid. 对于质心和图像边界之间的每条路径,找到距质心最近的非空像素。

These three first step are going to give you the pixels belonging to the first/smallest circle, plus some pixel of the second circle because the first circle is not discontinuous. 这三个第一步将为您提供属于第一个/最小圆的像素,再加上第二个圆的一些像素,因为第一个圆不连续。

  1. Hough detection. 霍夫检测。 I think that Hough circle is enough, but in case it does not work, I would use the Ellipsoid version. 我认为霍夫圆就足够了,但是如果它不起作用,我会使用Ellipsoid版本。
  2. You keep only the "most likely" circle. 您只保留“最可能”的圈子。

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

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