# Cv::stereo\_calibration() could not convert ‘16648’ from ‘int’ to ‘cv::TermCriteria’

**URL:** <https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154>\
**Category:** C++\
**Tags:** calib3d, build, core\
**Created:** [March 15, 2021, 2:09am UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154 "2021-03-15T02:09:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lulin](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lulin](https://forum.opencv.org/u/lulin)\
**Post date:** [March 15, 2021, 2:09am UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154/1 "2021-03-15T02:09:53Z")

</div>

Hello,

The problem encountered when I tried to build Azure-kinect sdk, and it is require OpenCV installed to build the sdk, the os is ubuntu 16.04, and I install the OpenCV by `sudo apt install libopencv-dev`.

Now I have opencv and opencv2 installed in my computer, when I start build sdk, the following error has occured:

```auto
FAILED: /usr/bin/c++ -I/usr/include/opencv -Isrc/sdk/include -I../include -O2 -g -DNDEBUG -fPIE -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wno-missing-field-initializers -Werror -std=gnu++11 -MD -MT examples/green_screen/CMakeFiles/green_screen.dir/main.cpp.o -MF examples/green_screen/CMakeFiles/green_screen.dir/main.cpp.o.d -o examples/green_screen/CMakeFiles/green_screen.dir/main.cpp.o -c ../examples/green_screen/main.cpp
../examples/green_screen/main.cpp: In function ‘Transformation stereo_calibration(const k4a::calibration&, const k4a::calibration&, const std::vector<std::vector<cv::Point_<float> > >&, const std::vector<std::vector<cv::Point_<float> > >&, const Size&, const Size&, float)’:
../examples/green_screen/main.cpp:505:116: error: could not convert ‘16648’ from ‘int’ to ‘cv::TermCriteria’
                                        cv::CALIB_FIX_INTRINSIC | cv::CALIB_RATIONAL_MODEL | cv::CALIB_CB_FAST_CHECK);
                                                                                                                    ^
ninja: build stopped: subcommand failed.

```

The error code is like this:

```auto
double error = cv::stereoCalibrate(chessboard_corners_world_nested_for_cv,
                                       secondary_chessboard_corners_list,
                                       main_chessboard_corners_list,
                                       secondary_camera_matrix,
                                       secondary_dist_coeff,
                                       main_camera_matrix,
                                       main_dist_coeff,
                                       image_size,
                                       tr.R, // output
                                       tr.t, // output
                                       cv::noArray(),
                                       cv::noArray(),
                                       cv::CALIB_FIX_INTRINSIC | cv::CALIB_RATIONAL_MODEL | cv::CALIB_CB_FAST_CHECK);

```

I guess it is the problem of the OpenCV version, Does anyone has some ideas in solving this problem?

Deepest thanks for your reply!

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [March 15, 2021, 7:49am UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154/2 "2021-03-15T07:49:03Z")

</div>

Please read the doc  
in last [doc](https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga91018d80e2a93ade37539f01e6f07de5) last argument is `TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, 1e-6)`. you can find specific doc version with menu (top left) 3.0 to 4.5.2  
You can find all version [here](https://docs.opencv.org/)  
For opencv 2 doc is here [Camera Calibration and 3D Reconstruction — OpenCV 2.4.13.7 documentation](https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=stereocalibrate#cv2.stereoCalibrate)

---

<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:** [March 15, 2021, 9:01am UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154/3 "2021-03-15T09:01:06Z")

</div>

> [@lulin](#):
>
> ubuntu 16.04

you’re getting OpenCV v2.4.9 or something close to that. Absolutely nobody should be using that anymore. any source code you find these days will be written for OpenCV v4.x or v3.x, and it will have trouble compiling against such an old version. the APIs are much improved now.

you should either get a fresher source of packages, or consider building OpenCV yourself from source.

---

<div class="post-metadata">

**Author:** ![lulin](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lulin](https://forum.opencv.org/u/lulin)\
**Post date:** [March 15, 2021, 10:25am UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154/5 "2021-03-15T10:25:02Z")

</div>

Thanks a lot for your prompt reply!

I think I need to try build the OpenCV from the source, but before that, I need to figure out which version I need, thanks for providing these useful links!

Thanks again!

---

<div class="post-metadata">

**Author:** ![lulin](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lulin](https://forum.opencv.org/u/lulin)\
**Post date:** [March 15, 2021, 10:25am UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154/6 "2021-03-15T10:25:49Z")

</div>

> [@crackwitz](#):
>
> you’re getting OpenCV v2.4.9 or something close to that. Absolutely nobody should be using that anymore. any source code you find these days will be written for OpenCV v4.x or v3.x, and it will have trouble compiling against such an old version. the APIs are much improved now.
> 
> you should either get a fresher source of packages, or consider building OpenCV yourself from source.

Thanks for your prompt reply!

The version of my OpenCV is v2.4.9. I do know that it is a very old version, but the code which had the error using `#include <opencv2/core.hpp>` , so I think it is using OpenCV v2.x.

And also it has a problem that is the `core.hpp` in my opencv 2 is located at `opencv2/core/core.hpp` , so I changed it to `#include <opencv2/core/core.hpp>` , otherwise it cannot find the location.

The reason why I used `sudo apt install libopencv-dev` to install OpenCv is followed the Kinect official instruction, but they only tested in ubuntu 18.04. So I wonder whether the version of OpenCV is installed different by this command in ubuntu 18.04 and ubuntu 16.04?

Maybe I need to try build OpenCV from source, but before that, I need to know the correct version.

Sorry for not provide more clear information before, do you have any ideas about which version I need to build from the source? Thanks again!

---

<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:** [March 15, 2021, 1:28pm UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154/7 "2021-03-15T13:28:15Z")

</div>

> [@lulin](#):
>
> The version of my OpenCV is v2.4.9. I do know that it is a very old version, but the code which had the error using `#include <opencv2/core.hpp>` , so I think it is using OpenCV v2.x.

no. “opencv2” has been the directory for those includes since OpenCV v2, and even v4.x uses that directory.

> [@lulin](#):
>
> So I wonder whether the version of OpenCV is installed different by this command in ubuntu 18.04 and ubuntu 16.04?

it is certainly different. debian/ubuntu packages are always outdated (concerning OpenCV that’s certain).

go with the latest release of OpenCV. the Kinect SDK should say. if they don’t, they need to fix that.

---

<div class="post-metadata">

**Author:** ![lulin](https://avatars.discourse-cdn.com/v4/letter/l/ee7513/32.png) [@lulin](https://forum.opencv.org/u/lulin)\
**Post date:** [March 15, 2021, 2:52pm UTC](https://forum.opencv.org/t/cv-stereo-calibration-could-not-convert-16648-from-int-to-cv-termcriteria/2154/8 "2021-03-15T14:52:25Z")

</div>

> [@crackwitz](#):
>
> no. “opencv2” has been the directory for those includes since OpenCV v2, and even v4.x uses that directory.

Deepest thanks for your reply! This problem has confused me a lot, I’ll try build latest version from the source.
