# Calibration Problem

**URL:** <https://forum.opencv.org/t/calibration-problem/13762>\
**Category:** Android/Java\
**Created:** [July 4, 2023, 11:20pm UTC](https://forum.opencv.org/t/calibration-problem/13762 "2023-07-04T23:20:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wanless](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/wanless/32/7965_2.png) [@wanless](https://forum.opencv.org/u/wanless)\
**Post date:** [July 4, 2023, 11:20pm UTC](https://forum.opencv.org/t/calibration-problem/13762/1 "2023-07-04T23:20:37Z")

</div>

When using the calibrateCamera function I am seeing a very large number being returned for the reprojection error for example in my last test the returned value was 192.15

I have included the code I am using along with an example of one of the chessboard images I am using, if anyone has any ideas or if anyone needs more information please let me know.

```auto
int boardH = 8,
        boardV = 5;
Size board_sz = new Size(boardH, boardV);

for (int j = 0; j < boardH*boardV; j++)
    obj.push_back(new MatOfPoint3f(new Point3(j / boardV, j % boardH, 0.0f)));

File dirFiles = this.getFilesDir();
for (String strFile : dirFiles.list())
{
    File file = this.getFileStreamPath(strFile);
    String extension = file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf("."));
    if (extension.equals(".jpg")) {
        Bitmap bmp = BitmapFactory.decodeFile(file.getAbsolutePath());
        Mat imageMat = new Mat();
        Mat grayMat = new Mat();
        Utils.bitmapToMat(bmp, imageMat);
        Imgproc.cvtColor(imageMat, grayMat, Imgproc.COLOR_RGB2GRAY);
        imageSize = imageMat.size();
        MatOfPoint2f corners = new MatOfPoint2f();

        boolean found = Calib3d.findChessboardCorners(grayMat, board_sz, corners);
        if (found) {
            Imgproc.cornerSubPix(grayMat, corners, board_sz, new Size(-1, -1), new TermCriteria(TermCriteria.EPS, 30, 0.001));
                img_points.add(corners);
                obj_points.add(obj);
        }
        Log.i(LOGTAG, "Found " + corners.size() + " " + found);
    }
}

double error = Calib3d.calibrateCamera(obj_points, img_points, imageSize, intrinsic, distCoeffs, rvecs, tvecs);

Log.i(LOGTAG, "error " + error);

```

 ![calib_2023-07-04_18-00-40](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/e/ed4043c1358d16bb6606ee5a9d5d02f4a97c6601.jpeg)

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [July 5, 2023, 5:13am UTC](https://forum.opencv.org/t/calibration-problem/13762/2 "2023-07-05T05:13:58Z")

</div>

blame your images, and your board  
(which has to be ABSOLUTELY FLAT)

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [July 5, 2023, 3:57pm UTC](https://forum.opencv.org/t/calibration-problem/13762/3 "2023-07-05T15:57:32Z")

</div>

an error of 192 is really quite a lot. I don’t think that can be entirely explained by the pattern being a little warped and the corners being a little off. the warped pattern needs to be fixed but there must be more going on here that you haven’t shown to us.

present the entire [MRE](https://stackoverflow.com/help/minimal-reproducible-example) including data. make sure it’s small. you’re asking other people to spend time on your problem. make it easy.
