我有带有暗点的灰度图像,可以将其转换为二进制(黑白)图像。
示例:
灰度输入:
黑白图片:
我需要在红色圆圈上找到点
如果没有尖角,点之间的距离或多或少是均匀的。
我有一个基于原始灰度图像和哈里斯角检测器以及聚类的半工作解决方案,但是它很慢,而且不那么简单。
我已经尝试过对圆进行霍夫变换,但是圆点太小(大约10x10 px左右),因此在没有太多噪声的情况下无法正确检测。
但是,我能够正确地检测出灰度图像中的线条-看到图像中的红线。我已经使用了这些知识,并根据与线的距离过滤点。
但是,在某些情况下,此操作将失败。例如,下面的图像非常有问题-鞭状边框上有一个“洞”,而点太靠近,连接到粗线。从被检测为点的数字中我也有误报。
您是否有理想的OpenCV解决方案的想法?
请注意,这只是一个示例,这些点可能不在细线上,而是分开的,或者细线太亮等。因此,该线不能用于检测点。
答案 0 :(得分:1)
潜在的解决方案是将morphological operations与 public async Task<IEnumerable> employeeTerminations()
{
return await Task.Run(() => _terminationHandler.GetEmployeeTerminations(EmployeeTerminations, EmployeeTerminationItems, OtherTerminationPayments));
}
内核一起使用以隔离小点。这个想法是使用Otsu's threshold获得一个二进制图像,然后使用轮廓区域过滤来过滤掉较大的非连接对象。从那里我们进行变形开放来隔离点。最后,我们找到轮廓并隔离点。结果如下:
代码
cv2.MORPH_ELLIPSE