Hi, I'd first ask on the Q&A page but since it is down I'm posting here first.
When running the given C++ tutorial on camera calibration I encounter the following error on both Windows (3.1.0 binaries) and Linux (recent clone of github repo, on default Ubuntu 14.04). I have used the calibration images available in the sample data. Using the same images and as far as I know identical settings I did not encounter errors when using the similar python tutorial ($OPENCV_DIR/samples/python/calibrate.py
).
Camera calibration, core.
Write camera data to path/file given in settings.xml
$ ./camera_calibration settings.xml
This is a camera calibration sample.
Usage: calibration configurationFile
Near the sample file you'll find the configuration file, which has detailed help of how to edit it. It may be any OpenCV supported file format XML/YAML.
OpenCV Error: Assertion failed (src.size == dst.size && src.channels() == dst.channels()) in cvConvertScale, file $OPENCV_DIR/modules/core/src/convert.cpp, line 5474
terminate called after throwing an instance of 'cv::Exception'
what(): $OPENCV_DIR/modules/core/src/convert.cpp:5474: error: (-215) src.size == dst.size && src.channels() == dst.channels() in function cvConvertScale
Aborted (core dumped)
Please try to give a full example which will compile as is.
$OPENCV_DIR/samples/data
in a folder images
$OPENCV_DIR/samples/cpp/tutorial_code/calib3d/camera_calbration
to working directorycmake .
followed by make
. CMakeLists.txt is based on the example given in http://docs.opencv.org/3.1.0/db/df5/tutorial_linux_gcc_cmake.html#gsc.tab=0./camera_calibration settings.xml
, alternatively for windows camera_calibration.exe settings.xml
Using the series of calibration images available in $OPENCV_DIR/samples/data
(left1-14.jpg and right1-14.jpg) as listed in image_list.xml
Rename from .txt
to get xml if needed.
settings.xml.txt
image_list.xml.txt
CMake:
CMakeLists.txt
Your image_list.xml contains wrong image paths, they should be as follows:
images/left01.jpg
images/left02.jpg
images/left03.jpg
...
I have same this bug.
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.0.0-pre) /opt/opencv/modules/core/src/convert_c.cpp:112: error: (-215:Assertion failed) src.size == dst.size && src.channels() == dst.channels() in function 'cvConvertScale'
in_VID5.xml
...
<BoardSize_Width>9</BoardSize_Width>
<BoardSize_Height>13</BoardSize_Height>
...
<Input>"/home/monxarat/projects/test/image/calibration/img/VID5.xml"</Input>
...
VID5.ml
<?xml version="1.0"?>
<opencv_storage>
<images>
/home/monxarat/projects/test/image/calibration/img/chess_6.jpg
/home/monxarat/projects/test/image/calibration/img/chess_6.jpg
</images>
</opencv_storage>
image
Run is OK if set config size_width
and size_height
with n - 1
and m - 1
(n is number of columns in real board-size, m is number of rows in real board-size)
<BoardSize_Width>12</BoardSize_Width>
<BoardSize_Height>8</BoardSize_Height>
Most helpful comment
Your image_list.xml contains wrong image paths, they should be as follows: