Ask Your Question
0

OpenCV Camera Calibration Parsing Error. How to solve it?

asked 2017-06-06 22:36:20 -0500

astronaut gravatar image

updated 2017-06-06 23:38:55 -0500

Im using the camera calibration source code from OpenCV in this link (http://docs.opencv.org/2.4/doc/tutori...)

In the configuration file may choose to use camera as an input, a video file or an image list.So I choose camera. So I tried to create a configuration file. Here’s my xml configuration file

<?xml version="1.0"?>
<opencv_storage>
<Settings>
<!-- Number of inner corners per a item row and column. (square, circle) -->
<BoardSize_Width>9</BoardSize_Width>
<BoardSize_Height>6</BoardSize_Height>
<!-- The size of a square in some user defined metric system (pixel, millimeter)-->
<Square_Size>50</Square_Size>
<!-- The type of input used for camera calibration. One of: CHESSBOARD CIRCLES_GRID ASYMMETRIC_CIRCLES_GRID -->
<Calibrate_Pattern>"CHESSBOARD"</Calibrate_Pattern>
<!-- 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" -->
<Input>3</Input>
<!-- If true (non-zero) we flip the input images around the horizontal axis.-->
<Input_FlipAroundHorizontalAxis>0</Input_FlipAroundHorizontalAxis>
<!-- Time delay between frames in case of camera. -->
<Input_Delay>100</Input_Delay>
<!-- How many frames to use, for calibration. -->
<Calibrate_NrOfFrameToUse>25</Calibrate_NrOfFrameToUse>
<!-- Consider only fy as a free parameter, the ratio fx/fy stays the same as in the input cameraMatrix. Use or not setting. 0 - False Non-Zero - True-->
<Calibrate_FixAspectRatio> 1 </Calibrate_FixAspectRatio>
<!-- If true (non-zero) tangential distortion coefficients are set to zeros and stay zero.-->
<Calibrate_AssumeZeroTangentialDistortion>1</Calibrate_AssumeZeroTangentialDistortion>
<!-- If true (non-zero) the principal point is not changed during the global optimization.-->
<Calibrate_FixPrincipalPointAtTheCenter> 1 </Calibrate_FixPrincipalPointAtTheCenter>
<!-- The name of the output log file. -->
<Write_outputFileName>"out_camera_data.xml"</Write_outputFileName>
<!-- If true (non-zero) we write to the output file the feature points.-->
<Write_DetectedFeaturePoints>1</Write_DetectedFeaturePoints>
<!-- If true (non-zero) we write to the output file the extrinsic camera parameters.-->
<Write_extrinsicParameters>1</Write_extrinsicParameters>
<!-- If true (non-zero) we show after calibration the undistorted images.-->
<Show_UndistortedImage>1</Show_UndistortedImage>
</Settings>
</opencv_storage>

The camera Id is 3. When run the code I got this error: OpenCV Error: Parsing error <C:/Calibration/CameraCalibration/config1.xml<16>: Preliminary end of the stream> in icvXMLParseTag

I dont understand what is the problem . Is it the chesssboard size? How should I chose the BoardSize_Width and BoardSize_Height? Any help? Or is there any bug in the code. In the cameraCalibration code im using this to read the settings:

Settings s;
const string inputSettingsFile = argc > 1 ? argv[1] :"C:/Calibration/Clibration/CameraCalibration1/config1.xml";
FileStorage fs(inputSettingsFile, FileStorage::READ); // Read the settings

I try to solve this problem for two days and still stuck as Im new in Camera Calibration and never done it before. Would really appreciate the help . Thanks

edit retag flag offensive close merge delete

Comments

please show the whole file. it complained about Preliminary end of the stream

berak gravatar imageberak ( 2017-06-06 23:11:17 -0500 )edit

ok edit it. I show the whole file now. Please check

astronaut gravatar imageastronaut ( 2017-06-06 23:16:28 -0500 )edit

-<opencv_storage> <-- the minus sign is real ?

berak gravatar imageberak ( 2017-06-06 23:35:58 -0500 )edit

no. Its not real, I changed it. Now I got this: Inexistent input: Invalid input detected. But I can see my camera is working and showing that ID is 3

astronaut gravatar imageastronaut ( 2017-06-06 23:40:44 -0500 )edit

ok, different error now. but i get same problem.

berak gravatar imageberak ( 2017-06-06 23:46:59 -0500 )edit

Yes. Because didnt save the whole config file. When I use the whole file got that Inexistent input: Invalid input detected.. Any help???

astronaut gravatar imageastronaut ( 2017-06-06 23:51:50 -0500 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2017-06-07 00:01:30 -0500

berak gravatar image

updated 2017-06-07 00:07:40 -0500

To use an input camera -> give the ID of the camera, like "1"

that is meant literally, it's trying to read a string, not a number, so you have to write:

 <Input>"3"</Input>

apart from that, using images from a live webcam is probably a bad idea here, you'll end uf with a lot of badly adjusted, unsharp, under/over illuminated images and such. better prerecord the images, see, that you have the whole field of view covered, all your images are clear, and use an image list in the calibration config. if you get a bad rms from the calibration, replace the worst images, and try again.

edit flag offensive delete link more

Comments

Ok. now giving no error. Its ok by <input>"0"</input>. But its open Image View , but then do nothing. Image view is all grey. Doesnt show the chessboard. Whts is the problem?

astronaut gravatar imageastronaut ( 2017-06-07 00:19:31 -0500 )edit

sorry, i do not understand, what you're saying, so - no idea.

berak gravatar imageberak ( 2017-06-07 00:27:16 -0500 )edit

Image View shows nothing. Program start but then nothing is doing.

astronaut gravatar imageastronaut ( 2017-06-07 01:50:35 -0500 )edit

Should I post new question regarding this problem?

astronaut gravatar imageastronaut ( 2017-06-07 01:50:54 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-06-06 22:36:20 -0500

Seen: 654 times

Last updated: Jun 07 '17