Ask Your Question

OpenCV camera_calibration sample. No input found.

asked 2016-10-12 03:01:15 -0500

NaviGer gravatar image

updated 2016-10-12 04:13:59 -0500


I'm trying to use the camera_calibration sample file of openCV. It compiles without errors, but for whatever reason the program is not working because the camera is not found.

Input does not exist: Invalid Input detected. Application stopping.

The code of the sample file that generates this error is:

    Settings s;
const string inputSettingsFile = argc > 1 ? argv[1] : "default.xml";
FileStorage fs(inputSettingsFile, FileStorage::READ); // Read the settings
if (!fs.isOpened())
    cout << "Could not open the configuration file: \"" << inputSettingsFile << "\"" << endl;
    return -1;
fs["Settings"] >> s;
fs.release();                                         // close Settings file
                                                      //! [file_read]

                                                      //FileStorage fout("settings.yml", FileStorage::WRITE); // write config as YAML
                                                      //fout << "Settings" << s;

if (!s.goodInput)
    cout << "Invalid input detected. Application stopping. " << endl;
    return -1;

The XML file looke like this:

<?xml version="1.0"?>
 <!-- Number of inner corners per a item row and column. (square, circle) -->
 <BoardSize_Width> 7</BoardSize_Width>
   <!-- The size of a square in some user defined metric system (pixel, millimeter)-->
     <!-- The type of input used for camera calibration. One of: CHESSBOARD CIRCLES_GRID ASYMMETRIC_CIRCLES_GRID -->
   <!-- The input to use for calibration.
        To use an input camera -> give the ID of the camera, like "1"
        To use an input video  -> give the path of the input video, like "/tmp/x.avi"
        To use an image list   -> give the path to the XML or YAML file containing the list of the images, like "/tmp/circles_list.xml"


The camera is found in all other programs. So the camera input is not the problem.

What could cause this error?

edit retag flag offensive close merge delete


try 0 for camera id (1 would actually be the second found webcam)

also, imho, taking single images and an imglist(xml) gives better results, since you can check them before, and weed out images with obstructed corners, specular highlites, bad pose etc.

berak gravatar imageberak ( 2016-10-12 03:15:38 -0500 )edit

Thanks for your help. But using 0 instead of 1 doesn't work either unfortunately.

Yes, using an image list works quite well. I guess I'll stick with using images then.

NaviGer gravatar imageNaviGer ( 2016-10-12 04:24:55 -0500 )edit

idk, maybe it's a flaw in the parser, try again with <Input>0</Input> (like, no additional linefeed/whitespace)

berak gravatar imageberak ( 2016-10-12 04:30:11 -0500 )edit


NaviGer gravatar imageNaviGer ( 2016-10-12 05:12:27 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-07-10 13:54:09 -0500

mannyglover gravatar image

I had this same issue. I solved it by including the camera index in quotes: changing <Input>0</Input> to <Input>"0"</Input> made it work. Silly, but there you have it.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-10-12 03:01:15 -0500

Seen: 299 times

Last updated: Jul 10