小编Nan*_*Shi的帖子

为什么我不能对此二进制图像进行斑点检测

首先,现在我正在使用Opencv通过Python2.7进行斑点检测。我要做的是在颜色检测后完成斑点检测。我想检测红色圆圈(标记),并避免其他斑点干扰,我想先进行颜色检测,然后再进行斑点检测。

颜色检测后的图像是二进制蒙版

现在,我想对此图像进行斑点检测,但是它不起作用。这是我的代码。

import cv2
import numpy as np;

# Read image
im = cv2.imread("myblob.jpg", cv2.IMREAD_GRAYSCALE)

# Set up the detector with default parameters.

params = cv2.SimpleBlobDetector_Params()
# Change thresholds
params.minThreshold = 10;    # the graylevel of images
params.maxThreshold = 200;

params.filterByColor = True
params.blobColor = 255

# Filter by Area
params.filterByArea = False
params.minArea = 10000

detector = cv2.SimpleBlobDetector(params)


# Detect blobs.
keypoints = detector.detect(im)

# Draw detected blobs as red circles.
# cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS ensures the size of …
Run Code Online (Sandbox Code Playgroud)

python binary opencv blob image-processing

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

binary ×1

blob ×1

image-processing ×1

opencv ×1

python ×1