HSV范围用于颜色过滤器

3

我正在使用OpenCV开发一个交通标志检测项目。在城市环境中,我需要一个好的HSV范围来过滤红色、蓝色和黄色的交通标志,以便缩小感兴趣区域。因此,我不需要非常精确的范围,只需要一个大致的估计值。有人可以帮帮我吗?

1个回答

8

你可能想阅读这个链接,我将有趣的部分摘录在下面:

How to find HSV values to track?

This is a common question found in stackoverflow.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]]]

Now you take [H-10, 100,100] and [H+10, 255, 255] as lower bound and upper bound respectively. Apart from this method, you can use any image editing tools like GIMP or any online converters to find these values, but don’t forget to adjust the HSV ranges.


谢谢,我会再深入研究它。 - Rachit Bhargava
你是如何得到[H-10, 100,100]的?答案是[[[60 255 255]]],现在你拿着它怎么办?请帮帮我。 - Freddy Daniel

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接