title: Errors with stereoCalibrate Function in OpenCV
body: <p>I'm trying to calibrate the output of the panasonic z10000 3D camera converted to two 640x360px mp4 testfiles.</p>
  
  <p>-I'm more a designer than a programmer (i never had any math subjects in college)
  so please excuse me for some supid errors </p>
  
  <p>I think my code looks good, but i don't get good results in the calibration-process
  the projection error of stereoCalibrate is about 6-20, but it should be &lt; 0.3 (i read here)</p>
  
  <p>I guess I'm doing something wrong with the imagePoints and the objectPoints - but I can't figure it out.</p>
  
  <p>After finding the chessBoardCorners I release the Videocapture to reload it after calibration</p>
  
  <p>The whole program (remapping, disparitymap) works, but the results are bad.</p>
  
  <pre><code>//Länge des Vektors zuweisen anhand der Bildpunkte
  vector&lt;Point3f&gt; obj;
  for(int j=0;j &lt; (Chess_X*Chess_Y);j++)
      obj.push_back(Point3f(j/Chess_X, j%Chess_Y, 0.0f));
  
  //Schleife für Frame Wiedergabe
  for(int counterLP= 0; Chess_Found&lt; Chess_Count; counterLP++)
  {
      //Übertrage Frame auf Matrix
      capRight&gt;&gt;rMat;
      capLeft&gt;&gt;lMat;
  
      //Prüfe auf Side by Side Video
      if(vid_input==2 || vid_input==3)
      {
          //Übertrage ROI auf Matrix
          lMat= roi( roiLeft);
          rMat= roi( roiRight);
      }
  
      //Ausgabe
      //cout&lt;&lt;rMat.cols&lt;&lt;"r"&lt;&lt;rMat.rows&lt;&lt;"\n";
      //cout&lt;&lt;lMat.cols&lt;&lt;"l"&lt;&lt;lMat.rows&lt;&lt;"\n";
  
  
      //Farben Konvertieren
      cvtColor( lMat, lMat_grey, CV_RGB2GRAY);
      cvtColor( rMat, rMat_grey, CV_RGB2GRAY);
  
      //Überprüfe jeden fünften Frame
      if(counterLP%5==0)
      {
          //Suche Schachbrettmuster auf Matrix
          successLeft= findChessboardCorners( lMat_grey, Chess_size, cornersLeft, CALIB_CB_ADAPTIVE_THRESH);
          successRight= findChessboardCorners( rMat_grey, Chess_size, cornersRight, CALIB_CB_ADAPTIVE_THRESH);
  
          //Wenn Schachbrettmuster gefunden wurde
          if( successLeft &amp;&amp; successRight)
          {
  
              //Muster genauer bestimmen
              cornerSubPix( lMat_grey, cornersLeft, Size( 5, 5),Size( -1, -1),TermCriteria( CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 50, 0.01 ));
              cornerSubPix( rMat_grey, cornersRight, Size( 5, 5),Size( -1, -1),TermCriteria( CV_TERMCRIT_ITER + CV_TERMCRIT_EPS, 50, 0.01 ));
  
              //Zeichne Schachbrettmuster
              drawChessboardCorners( lMat, Chess_size, Mat(cornersLeft), successLeft);
              drawChessboardCorners( rMat, Chess_size, Mat(cornersRight), successRight);
  
              //
              imagePointsLeft.push_back(cornersLeft);
              imagePointsRight.push_back(cornersRight);
  
              objectPoints.push_back(obj);
              cout &lt;&lt; "Punkte gespeichert\n";
  
              //Zeige Farbbild
              imshow( "Left", lMat);
              imshow( "Right", rMat);
  
              //Erfolgreich
              Chess_Found++;
              //cout&lt;&lt; Chess_Found &lt;&lt; " Muster gefunden!\n";
  
              //Sicherheitsprüfung
              successLeft= false;
              successRight= false;
          }
      }
      else
      {
          //Zeige graues Bild
          imshow( "Left", lMat_grey);
          imshow( "Right", rMat_grey);
      }
  
      //33ms verzögerung
      if (waitKey(30) &gt;= 0)
          break;
  }
  
  //Schließe Streams
  capLeft.release();
  capRight.release();
  
  //Schließe Fenster
  destroyAllWindows();
  
  //Erzeuge identifizierte Kamera Matrix
  Mat camMatLeft = Mat::eye(3, 3, CV_64FC1);
  Mat camMatRight = Mat::eye(3, 3, CV_64FC1);
  
  //Erzeuge Distranzkoeffizienten
  Mat distCoLeft;
  Mat distCoRight;
  
  //Erzeuge Rotationsvektor
  Mat rvecs;
  
  //Erzeuge Verschiebungsvektor
  Mat tvecs;
  
  //Erzeuge Output essential Matrix
  Mat essMat;
  
  //Erzeuge Output fundamental Matrix
  Mat funMat;
  
  //Starte Kalibrierung
  cout &lt;&lt; "Starte Kalibrierung\n";
  
  
  
  //Kalibrierung
  double s = stereoCalibrate(objectPoints, imagePointsLeft, imagePointsRight, camMatLeft, distCoLeft, camMatRight, distCoRight, Size(640,360), rvecs,  tvecs, essMat, funMat, cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS, 100, 1e-5),CV_CALIB_FIX_ASPECT_RATIO+CV_CALIB_ZERO_TANGENT_DIST + CV_CALIB_SAME_FOCAL_LENGTH);
  cout &lt;&lt;"Fehler: " &lt;&lt;s&lt;&lt;endl;
  </code></pre>
  
  <p>Thank you</p>