【发布时间】:2020-12-05 04:39:15
【问题描述】:
我在家做项目基本上只是为了好玩,但我遇到的麻烦比预期的要多。我希望能够在此示例图像中找到音高标记。 enter image description here
我遵循了一些教程和一些东西来从某个位置加载图像并在图像上运行简单的 blob 检测。我的代码目前如下 ->
import cv2
import numpy as np
# Read in the image in grayscale
img = cv2.imread('/home/pi/Downloads/divot1.jpeg', cv2.IMREAD_GRAYSCALE)
params = cv2.SimpleBlobDetector_Params()
params.filterByArea = True
params.minArea = 50
# Determine which openCV version were using
if cv2.__version__.startswith('2.'):
detector = cv2.SimpleBlobDetector(params)
else:
detector = cv2.SimpleBlobDetector_create(params)
# Detect the blobs in the image
keypoints = detector.detect(img)
print(len(keypoints))
# Draw detected keypoints as red circles
imgKeyPoints = cv2.drawKeypoints(img, keypoints, np.array([]), (0,0,255), cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
# Display found keypoints
cv2.imshow("Keypoints", imgKeyPoints)
cv2.waitKey(0)
cv2.destroyAllWindows()
我知道在使用 openCV 时还有很多图像处理技术,但我希望有人能指出我正确的方向。我尝试了一些方法,比如各种模糊类型,以消除每片草叶的一些“噪音”。我也尝试弄乱一些参数,尽管我不确定我使用的参数是否有帮助(min/maxAREA、color、convexity)
最终目标是能够找到图像中的深褐色异常,并返回该形状的中心“坐标”。
【问题讨论】:
标签: python opencv image-processing