title: Converting BGR to HSV to find specific color
body: <p>There are plenty of tutorials on this, but I think I'm missing something important about the HSV realm. </p>
  
  <p>I'm looking specifically for the color <code>(RGB) 98,199,166</code> an off blue color.</p>
  
  <p>In my code I convert my image to HSV like so.</p>
  
  <pre><code>cvtColor(OriginalImage, HSVImage, COLOR_BGR2HSV);
  </code></pre>
  
  <p>I then find the RBG range of colors around that blue, so I choose <code>68, 83, 119</code> and <code>150, 164, 194</code> for my lower bound and upper bound respectively. </p>
  
  <p>Using this <a href="https://www.rapidtables.com/convert/color/rgb-to-hsv.html" rel="nofollow noreferrer">website</a> I convert the lowerbound and upperbound to HSV to get <code>222, 42.9, 46.7</code> and <code>221, 22.7, 76.1</code></p>
  
  <p>Then in my C++ code I use the inrange function</p>
  
  <pre><code>inRange(HSVImage, Scalar(222, 42.9, 46.7), Scalar(221, 22.7, 76.1), ImgColorFound);
  </code></pre>
  
  <p>When I display this, it has not found the specific color I am looking for.</p>
  
  <pre><code>imshow("ObjectOfSpecificColor", ImgColorFound);
  </code></pre>
  
  <p>I'm not sure what i am missing or not understanding, but from the tutorials I've seen, it seems like this should find my color.</p>
  
  <p>I'm also using the latest OpenCV (401 I believe) </p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>#include &lt;opencv2/opencv.hpp&gt;
  #include "opencv2/imgproc.hpp"
  #include "opencv2/highgui.hpp"
  #include "opencv2/core.hpp"
  #include &lt;Windows.h&gt;
  #include &lt;iostream&gt;
  #include &lt;tchar.h&gt;
  using namespace std;
  using namespace cv;
  
  Scalar BGR2HSV(uchar B, uchar G, uchar R)
  {
      Mat hsv;
      Mat bgr(1, 1, CV_8UC3, Scalar(B, G, R));
      cvtColor(bgr, hsv, COLOR_BGR2HSV);
      return Scalar(hsv.data[0], hsv.data[1], hsv.data[2]);
  }
  
  int main(int argc, char **argv)
  {
      Mat Img = imread("C:\\TestImage.png");
      Mat FindBlueArea;
      Mat HSVImage;
      cvtColor(Img, HSVImage, COLOR_BGR2HSV);
      inRange(HSVImage, BGR2HSV(119, 83, 68), BGR2HSV(194, 164, 150), FindBlueArea);
  
      namedWindow("Original Image", WINDOW_NORMAL);
      imshow("Original Image", Img);
      namedWindow("HSVImage", WINDOW_NORMAL);
      imshow("HSVImage", HSVImage);
      namedWindow("BlueArea", WINDOW_NORMAL);
      imshow("BlueArea", FindBlueArea);
      waitKey(5000);
  }
  </code></pre>
  
  <p>In the actual program this is read from frame of an active window, but at any rate it still doesn't behave how I expect.</p>
  
  <p><a href="https://i.stack.imgur.com/WYhRB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WYhRB.png" alt="Image To Find blue part"></a></p>
  
  <p>The image is a little small, but I'm trying to find only the blue blob part, and leave all the small blue circles and everything else out.</p>