What ordering are the colour channels by defaul in OpenCV?
For reasons best (or maybe only known) to its developers, OpenCV orders its channels as blue, green, red. Weird, isn't it?
Why are the HSV values used by most people changed for use in OpenCV?
RGB-to-HSV conversion is performed in-place by cv2.cvtColor, so the values need to be able to fit into the same unsigned byte representation as the original pixels.
Which OpenCV HSV values are closest to (180, 50, 50)?
- (360, 255, 255)
(90, 128, 128)
- (0, 0, 0)
- (360, 100, 100)
You can work this one out just by looking at the numbers: they are half-way through the possible ranges in each case, so the answer is the middle of the ranges used by OpenCV.
Why is segmenting red difficult in HSV colour space?
Red hues have values of zero up to about 30 degrees AND from about 330 to 360 degrees, meaning you need two separate masks with cv2.inRange to isolate them.
How would two masks returned from cv2.inRange be combined?
- by subtracting them
- by XOR-ing them
- by AND-ing them
by OR-ing them
The easiest way to combine masks from cv2.inRange is to OR them.
What does saturation mean in HSV colour space?
Saturation is how far the colour lies away from the grey line (the black-to-white axis of the colour cone), with colourse becoming more intense as the saturation moves from grey on the axis to fully-saturated at the edge of the cone.
What colour correspond to HSV values (120, 0, 100)?
The saturation is zero, so this is lies on the black-to-white axis. Its value is 100, so it is a mid-grey.
Given a three-channel colour image as input, what does cv2.inRange return?
cv2.inRange returns a 2D image with pixels set to 255 where they lie in range and zero otherwise.
What data type are the colour arguments in a call to cv2.inRange?
- integer
- float
a tuple
- a list
You normally write the colours as a triplet of integer values in round brackets, and that makes them into what Python calls a tuple.
What colour corresponds roughly to HSV values (60, 90, 90)?
The hue is roughly mid-way between red and green, so the shade is yellow. The saturation and value are both high, so this is actually a bright yellow.