SimpleCV - 检测图像中的亮点

时间:2017-02-23 17:07:00

标签: python python-2.7 simplecv

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

1 个答案:

答案 0 :(得分:0)

您可以在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

编辑: 要将blob从最亮到最暗排序,请使用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()