我有这个图像:
我一直在使用opencv功能SimpleBlobDetector
来识别黑色背景上的白色像素块。以下是代码。blobDetectorParameters = cv2.SimpleBlobDetector_Params()
blobDetectorParameters.filterByArea = True
blobDetectorParameters.minArea = 1
blobDetectorParameters.maxArea = 100
blobDetectorParameters.minDistBetweenBlobs = 1
blobDetectorParameters.filterByCircularity = False
blobDetectorParameters.filterByColor = False
blobDetectorParameters.filterByConvexity = False
blobDetectorParameters.filterByInertia = False
detector = cv2.SimpleBlobDetector_create(blobDetectorParameters)
keypoints = detector.detect(image)
imageWithKeypoints = cv2.drawKeypoints(image, keypoints, numpy.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv2.imshow("Keypoints", imageWithKeypoints)
cv2.waitKey(0)
以下哪个选项正确地识别了下面图像中显示的斑点: 问题: 我希望能够有一个列出所有blob像素的列表,以便将它们涂成黑色。使用
SimpleBlobDetector
,我似乎找不到一种返回所有blob像素的方法。我可以得到关键点(通过detect
返回),但我认为这些对应于blob中心。
我还应该补充说明,我只想涂出特定大小的blob,这就是抓取所有白色像素的普适方法不理想的原因。
是否有与SimpleBlobDetector
(或OpenCV内部的其他地方)相关的函数来返回与所有blob相关的所有像素?
提前感谢您的帮助。