title: What does Mat::checkVector do in OpenCV?
body: <p>I tried to use the following function in OpenCV (C++)</p>
  
  <pre><code>calcOpticalFlowPyrLK(prev_frame_gray, frame_gray, points[0], points[1], status, err, winSize, 3, termcrit, 0, 0.001);
  </code></pre>
  
  <p>and I get this error</p>
  
  <pre><code>OpenCV Error: Assertion failed ((npoints = prevPtsMat.checkVector(2, CV_32F, true)) &gt;= 0) in calcOpticalFlowPyrLK,
  file /home/rohit/OpenCV_src/opencv-2.4.9/modules/video/src/lkpyramid.cpp, line 845
  terminate called after throwing an instance of 'cv::Exception'
  what():  /home/rohit/OpenCV_src/opencv-2.4.9/modules/video/src/lkpyramid.cpp:845:
  error: (-215) (npoints = prevPtsMat.checkVector(2, CV_32F, true)) &gt;= 0 in function calcOpticalFlowPyrLK
  </code></pre>
  
  <p>Both of the following return -1</p>
  
  <pre><code>frame_gray.checkVector(2, CV_32F, true)
  prev_frame_gray.checkVector(2, CV_32F, true)
  </code></pre>
  
  <p>I wanted to know what checkVector actually does because it is leading to the assertion error as you can see above.</p>