1
这是我的代码,并通过使用此代码亮点完美检测如图所示。但问题是即使现场不存在它会检测图像中的虚假斑点可以帮助我如何摆脱这个?如何避免虚假亮点检测?
# import the necessary packages
import numpy as np
import argparse
import cv2
# construct the argument parse and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", help = "Desktop")
ap.add_argument("-r", "--radius", type = int,
\t help = "radius of Gaussian blur; must be odd")
args = vars(ap.parse_args())
# load the image and convert it to grayscale
image1 = cv2.imread("h.png")
orig = image1.copy()
gray = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (args["radius"], args["radius"]), 0)
(minVal, maxVal, minLoc, maxLoc) = cv2.minMaxLoc(gray)
image1 = orig.copy()
cv2.circle(image1, maxLoc, args["radius"], (255, 0, 0), 2)
# display the results of our newly improved method
cv2.imwrite("myImage.png", image1)
[1]: https://i.stack.imgur.com/6CDYP.png
非常感谢你为ZdaR您宝贵的建议,我会尝试,让你知道 –
即使我使用的检测阈值假斑点@ ZdaR..what我可不可以做?? –
你可以给你的邮件编号,我会详细告诉你我是'[email protected]' –