小编coM*_*ENT的帖子

OpenCV Blob检测器未检测到白色Blob

我正在尝试计算阈值后的白点数量,但我的代码似乎没有检测到任何东西

输入图像

在此处输入图片说明

#Standard imports
#!/usr/bin/python

# Standard imports
import cv2
import numpy as np;

# Read and threshold image
im = cv2.imread("CopperSEM.tif", cv2.IMREAD_GRAYSCALE)
ret2, LocalTH1 = cv2.threshold(im,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU) #Without Filtering

# Set up the detector with default parameters.
parameters = cv2.SimpleBlobDetector_Params()

#change Colors to White
parameters.filterByColor = True
parameters.blobColor = 255
parameters.filterByArea = True
parameters.minArea = 1500
parameters.filterByCircularity = True
parameters.minCircularity = 0.1
parameters.filterByConvexity = True
parameters.minConvexity = 0.87


#reset the detector
detector = cv2.SimpleBlobDetector_create(parameters)

# Detect blobs.
keypoints = detector.detect(LocalTH1) …
Run Code Online (Sandbox Code Playgroud)

python opencv image-processing contour computer-vision

5
推荐指数
1
解决办法
107
查看次数