SimpleCV - 检测图像中的亮点

SimpleCV - detect bright spots in an image

因此,我需要使用 SimpleCV 和 python 检测图像中的亮点。 我已经整理好了图像采集,我唯一的问题是找到亮点。知道我该怎么做吗? (已经有高斯模糊,用于点到区域的转换)

您可以在 SimpleCV 中使用 findBlobs 函数。

#find the green ball
green_channel = Camera().getImage().splitChannels[1]

green_blobs = green_channel.findBlobs()
#blobs are returned in order of area, largest first

print "largest green blob at " + str(green_blobs[0].x) + ", " + str(green_blobs[0].y)

示例来自:http://simplecv.readthedocs.io/en/1.0/cookbook/#blob-detection

更多相关概念的文档:http://simplecv.sourceforge.net/doc/SimpleCV.Features.html#module-SimpleCV.Features.BlobMaker

编辑: 要使斑点从最亮到最暗排序,您可以使用 sortColorDistance() 方法:

blurred = camera.applyGaussianFilter(grayscale=True)
#find them blobs
blobs = blurred.findBlobs()
#draw their outlines
blobs.draw(autocolor=True)
#sort them from brightest to darkest and get center of the brightest one
brightest = blobs.sortColorDistance((255, 255, 255))[0].coordinates()