title: OpenCV Error: Assertion failed (((((sizeof(size_t)<<28)|0x8442211).... line 957
body: <p>I'm trying to get the color(rgb value) under my cursor. When my is code compiled and i run it my program there is a box that says <strong>"Unhandled exception at 0x00007FFBF64B3C58 in thing_1.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000001DA30FEFB0."</strong>. When i press continue the box just comes back. I'm new to coding so it might be a newbie mistake and sorry for my messy code...</p>
  
  <pre><code>#include "opencv2/highgui/highgui.hpp"
  #include &lt;iostream&gt;
  #include &lt;Windows.h&gt;
  
  using namespace cv;
  using namespace std;
  
  boolean k = true;
  
  POINT cursorPosition;
  
  HWND hWnd;
  
  int main(int argc, char* argv[]){
   VideoCapture cap(0);
  
   while (1){
      Mat frame;
  
      bool bSuccess = cap.read(frame);
  
      imshow("Video", frame);
  
      if (waitKey(10) == 27){
          break;
      }
  
      if (k == true){
          hWnd = GetActiveWindow();
          k = false;
      }
  
       GetCursorPos(&amp;cursorPosition);
       ScreenToClient(hWnd, &amp;cursorPosition);
  
       if (cursorPosition.x &lt; 0) {cursorPosition.x = 0;}
       if (cursorPosition.x &gt; 640) {cursorPosition.x = 640;}
       if (cursorPosition.y &lt; 0) {cursorPosition.y = 0;}
       if (cursorPosition.y &gt; 479) {cursorPosition.y = 479;}
  
          Vec4b intensity = frame.at&lt;Vec4b&gt;(cursorPosition.x, cursorPosition.y);
  
          uchar blue = intensity.val[0];
          uchar green = intensity.val[1];
          uchar red = intensity.val[2];
  
          std::cout &lt;&lt; "red = " &lt;&lt; int(red) &lt;&lt; " | green = " &lt;&lt; int(green) &lt;&lt; " | blue = " &lt;&lt; int(blue) &lt;&lt; " | X: " &lt;&lt; cursorPosition.x &lt;&lt; " |Y: " &lt;&lt; cursorPosition.y &lt;&lt; std::endl;
    }
   return 0;
   }
  </code></pre>