title: How to get OpenCV HSV value from hexadecimal color value in C++?
body: <p>I want to detect a white/grey object in OpenCV and therefore I need to convert <code>#B4BAB8</code> into a OpenCV HSV value. I tried so many things, but I don know how to calculate the lowerb and upperb of this color.. #B4BAB8 is the color of the object.</p>
  
  <p>What values should I use in <code>cv::inRange(frmHsv, cv::Scalar([WHAT VALUE?]), cv::Scalar([WHAT VALUE?]), rangeRes);</code> ?</p>
  
  <pre><code> cv::Mat frmHsv;
   cv::cvtColor(blur, frmHsv, CV_BGR2HSV);
   // &lt;&lt;&lt;&lt;&lt; HSV conversion
  
   // &gt;&gt;&gt;&gt;&gt; Color Thresholding
   // Note: change parameters for different colors
   cv::Mat rangeRes = cv::Mat::zeros(rgbmat.size(), CV_8UC1);
   cv::inRange(frmHsv, cv::Scalar([WHAT VALUE?]), cv::Scalar([WHAT VALUE?]), rangeRes);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/lt5wT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lt5wT.png" alt="enter image description here"></a></p>