Skip to content

CPP Camera Calibration example does not work #6503

@wmfuture

Description

@wmfuture

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).

Please state the information for your system

  • OpenCV version: 3.1.0
  • Host OS: Linux (Ubuntu 14.04) [built from recent github source] & Windows 10 [sourceforge binaries]

In which part of the OpenCV library you got the issue?

Camera calibration, core.

Expected behaviour

Write camera data to path/file given in settings.xml

Actual behaviour

$ ./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)

Code example to reproduce the issue / Steps to reproduce the issue

Please try to give a full example which will compile as is.

  1. Placed the sample calibration images from $OPENCV_DIR/samples/data in a folder images
  2. Copied sample code from $OPENCV_DIR/samples/cpp/tutorial_code/calib3d/camera_calbration to working directory
  3. Compiled using cmake . 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
  4. Run with ./camera_calibration settings.xml, alternatively for windows camera_calibration.exe settings.xml
  5. Receive error message

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

Relevant files

Rename from .txt to get xml if needed.
settings.xml.txt
image_list.xml.txt
CMake:
CMakeLists.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions