title: OpenCV Stereo Calibration (example code questions)
body: <p>At the moment I am implementing the calibration method(s) for stereo vision. I am using the OpenCV library.</p>
  
  <p>There is an example in the sample folder, but I have some questions about the implementation:</p>
  
  <p>Where are these array's for and what are those CvMat variables?</p>
  
  <pre><code>// ARRAY AND VECTOR STORAGE:
  double M1[3][3], M2[3][3], D1[5], D2[5];
  double R[3][3], T[3], E[3][3], F[3][3];
  CvMat _M1 = cvMat(3, 3, CV_64F, M1 );
  CvMat _M2 = cvMat(3, 3, CV_64F, M2 );
  CvMat _D1 = cvMat(1, 5, CV_64F, D1 );
  CvMat _D2 = cvMat(1, 5, CV_64F, D2 );
  CvMat _R = cvMat(3, 3, CV_64F, R );
  CvMat _T = cvMat(3, 1, CV_64F, T );
  CvMat _E = cvMat(3, 3, CV_64F, E );
  CvMat _F = cvMat(3, 3, CV_64F, F );
  </code></pre>
  
  <p>In other examples I see this code:</p>
  
  <pre><code>//--------Find and Draw chessboard--------------------------------------------------    
  
      if((frame++ % 20) == 0)
      {
          //----------------CAM1-------------------------------------------------------------------------------------------------------
          result1 = cvFindChessboardCorners( frame1, board_sz,&amp;temp1[0], &amp;count1,CV_CALIB_CB_ADAPTIVE_THRESH|CV_CALIB_CB_FILTER_QUADS);
          cvCvtColor( frame1, gray_fr1, CV_BGR2GRAY );
  </code></pre>
  
  <p>What does the if statement exactly do? Why %20?</p>
  
  <p>Thank you in advance!</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>I have a two questions about some implementation code: <a href="https://www.assembla.com/code/depthmap/subversion/nodes/stereo%20vision%20-%20Heinrich.cpp?rev=7" rel="nofollow">link</a></p>
  
  <p>-1: Those nx and ny variables that are declared in line 18 and used in the board_sz variable at line 25. Are these nx and ny the rows and columns or the corners in the chessboard pattern? (I think that these are the rows and columns, because cvSize has parameters for width and height).</p>
  
  <p>-2: What are these CvMat variables for (lines 143 - 146)?</p>
  
  <pre><code>CvMat _objectPoints = cvMat(1, N, CV_32FC3, &amp;objectPoints[0] );
  CvMat _imagePoints1 = cvMat(1, N, CV_32FC2, &amp;points[0][0] );
  CvMat _imagePoints2 = cvMat(1, N, CV_32FC2, &amp;points[1][0] );
  CvMat _npoints = cvMat(1, npoints.size(), CV_32S, &amp;npoints[0] );
  </code></pre>