Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::inRange higher bound out of range of 0-180 in HSV

I am working on segmenting the image based on the colour.

Right now I am considering how the cv::inRange function performs if my upper range of specific channel will be higher than max. value if 180, while the actual value on image will be close to 0?

Please let me present an example in HSV colour space: I have the filter with lowerb = (170, 50, 50), upperb = (190, 255, 255). Here I want to detect pink colour, which comes further into orange, so that the points of H are slightly above 0.

In the given case will the point (5, 180, 180) get accepted, so that cv::inRange will append the points above 0? Or should I apply two inRange filters:

lowerb = (170, 50, 50), upperb (179, 255, 255)
lowerb = (0, 50, 50), upperb (10, 255, 255)

and sum the results to achieve what I need?

I was trying to find the answer to my question in the OpenCV source code, but it was rather difficult to understand...