1 | initial version |
Well, I'm so dumb.
Converting a frame from one palette to another one and using cv::inRange are two things completely different. I thought there was a link between the method used to convert the frame and the bounds of inRange() function, but there are absolutely not.
I hope that my answer will help some people that are confused using those functions together.
Converting a frame from one palette to another one is a thing. Whether you use a particular method, the result is the same : the pixels will be color-converted and the colors will be situated in RGB palette (BGR on OpenCV). Whether you use BGR2HSV or BGR2HLS, pixels will be color-converted to another color.
Using cv::inRange to thresh your frame is another thing. I had originally thought that depending on the method used to color-convert pixels, the bounds of the inRange() function would be different: absolutely not. Since the results of the color-conversion remain in the RGB palette, the bounds must be defined in RGB too (BGR on OpenCV).
cv::Scalar(minimum_blue, minimum_green, minimum_red)
cv::Scalar(maximum_blue, maximum_green, maximum_red)
So, for example, if you only want to retrieve some purple, this would be :
cv::Scalar(135, 0, 65)
cv::Scalar(200, 70, 130)
(NB: this is an example. These bounds are correctly set for purple but they're not an absolute reference for the purple you would consider to retrieve by yourself)