HSV ranges for color filter

2019-03-22 03:47发布

I am working on a project on detecting traffic signs in opencv. I need a good HSV range to filter out red, blue and yellow traffic signs in the urban environment. This is just so that I have a smaller region of interest. So I do not want a highly accurate range but a rough estimate. Can anyone help me out??

标签: opencv hsv
1条回答
爷、活的狠高调
2楼-- · 2019-03-22 04:11

You might want to read this link. I extract the interesting part here:

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.

查看更多
登录 后发表回答