私は単純に画像内の白い丸い塊を見つけることを試みています。ハーフサークルを使ってみると、文字と数字が円であると誤認されますが、完全な円、つまりブロブしか必要ありません。白い塊を検出することができません - opencv python
このブロブ検出器コードをカスタムパラメータで実行して、左上隅の円形ICピンのマークを見つけました。しかし、私は '9'と '0'の中にダークサークルを続けています。 白い斑点はまったく検出されません。ここ
私が試みコードである:ここ
import cv2
import numpy as np;
# Read image
img = cv2.imread("C:\chi4.jpg", cv2.IMREAD_GRAYSCALE)
retval, threshold = cv2.threshold(img, 200, 255, cv2.THRESH_BINARY)
params = cv2.SimpleBlobDetector_Params()
# Change thresholds
params.minThreshold = 10;
params.maxThreshold = 255;
blur = cv2.GaussianBlur(img,(5,5),0)
params.filterByCircularity = True
params.minCircularity = 0.2
params.filterByArea = True;
params.minArea = 1000;
ver = (cv2.__version__).split('.')
if int(ver[0]) < 3 :
detector = cv2.SimpleBlobDetector(params)
else :
detector = cv2.SimpleBlobDetector_create(params)
# Set up the detector with default parameters.
#detector = cv2.SimpleBlobDetector()
# Detect blobs.
keypoints = detector.detect(threshold)
# Draw detected blobs as red circles.
# cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS ensures the size of the circle corresponds to the size of blob
im_with_keypoints = cv2.drawKeypoints(img, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
# Show keypoints
cv2.imshow("Keypoints", im_with_keypoints)
cv2.waitKey(0)
赤丸検出するものです。私は、青でマークされた上部の白い丸い塊を検出したい。
しきい値パラメータを変更しようとしましたが、影響はありません。私が間違っている場所や出力を改善するための提案を教えてください。 ありがとうございます。D
を、あなたは、元の画像をアップロードすることができますか? –
これは元の画像です。 usbデジタル顕微鏡を使用してキャプチャ –