滤色器的 HSV 范围
HSV ranges for color filter
我正在做一个在 opencv 中检测交通标志的项目。我需要一个良好的 HSV 范围来过滤掉城市环境中的红色、蓝色和黄色交通标志。这只是为了让我的兴趣区域更小。所以我不想要一个高度准确的范围,而是一个粗略的估计。谁能帮我吗??
您可能想阅读这篇文章 link。我在这里提取有趣的部分:
How to find HSV values to track?
This is a common question found in whosebug.com. It is very simple and you can use the same function, cv2.cvtColor()
. Instead of passing an image, you just pass the BGR values you want. For example, to find the HSV value of Green, try following commands in Python terminal:
green = np.uint8([[[0,255,0 ]]])
hsv_green = cv2.cvtColor(green,cv2.COLOR_BGR2HSV)
print hsv_green
[[[ 60 255 255]]]
现在你分别取[H-10, 100,100]
和[H+10, 255, 255]
作为下限和上限。除了这种方法,您还可以使用任何图像编辑工具(如 GIMP)或任何在线转换器来查找这些值,但不要忘记调整 HSV 范围。
我正在做一个在 opencv 中检测交通标志的项目。我需要一个良好的 HSV 范围来过滤掉城市环境中的红色、蓝色和黄色交通标志。这只是为了让我的兴趣区域更小。所以我不想要一个高度准确的范围,而是一个粗略的估计。谁能帮我吗??
您可能想阅读这篇文章 link。我在这里提取有趣的部分:
How to find HSV values to track?
This is a common question found in whosebug.com. It is very simple and you can use the same function,
cv2.cvtColor()
. Instead of passing an image, you just pass the BGR values you want. For example, to find the HSV value of Green, try following commands in Python terminal:green = np.uint8([[[0,255,0 ]]]) hsv_green = cv2.cvtColor(green,cv2.COLOR_BGR2HSV) print hsv_green
[[[ 60 255 255]]]
现在你分别取
[H-10, 100,100]
和[H+10, 255, 255]
作为下限和上限。除了这种方法,您还可以使用任何图像编辑工具(如 GIMP)或任何在线转换器来查找这些值,但不要忘记调整 HSV 范围。