title: Python CV2 color detection confusion
body: <p>Let's say I have the image below and I want to detect the color red. A possible way is to find the lower and upper HSV range and add a mask:</p>
  <pre><code>mask = cv2.inRange(imgHSV, low, high)
  </code></pre>
  <p>In order to get the <code>low</code> and <code>high</code> values, here is what I would do:</p>
  <p>I would first get the RGB value of a light red pixel, let's say the RGB is <code>(112, 4, 61)</code>. I would then convert it to <code>HSV</code> using the following calculator: <a href="https://www.rapidtables.com/convert/color/rgb-to-hsv.html" rel="nofollow noreferrer">https://www.rapidtables.com/convert/color/rgb-to-hsv.html</a></p>
  <p>I would get HSV as H = <code>328 degrees</code>, <code>S = 96%</code>, <code>V = 44%</code>. Let's say the upper limit has <code>H = 350 degrees</code>.</p>
  <p><a href="https://i.stack.imgur.com/jiuY2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jiuY2.jpg" alt="enter image description here" /></a></p>
  <p>What makes sense to me is the following:</p>
  <p><code>mask = cv2.inRange(hsv, (328//2, int(0.96 * 255), int(0.44 * 255)), (350/2, 255, 255))</code></p>
  <p>The first divide by 2 since <code>cv2</code> stores hue as <code>0-180</code>, the second and third are percentages multiplied the max value of saturation and value.</p>
  <p>However, this fails to give me the right answer. What I <strong>should</strong> be doing is the following:</p>
  <p><code>mask = cv2.inRange(hsv, (328//2, 96, 44), (350/2, 255, 255))</code></p>
  <p>I don't understand. If the calculator said the saturation is <code>96%</code>, and saturation ranges from <code>0-255</code>, why am I putting <code>96</code> here? It would make sense to put <code>95%</code> of <code>255</code>?</p>