Ask Your Question
1

OpenCV Error: Bad argument (Unknown array type) in cvarrToMat

asked 2015-01-28 02:49:25 -0600

_Student_ gravatar image

updated 2015-01-28 03:27:50 -0600

Hi Everyone

I am trying to run this calibration program :

http://fossies.org/linux/opencv/sampl...

I already compiled it successfully using CMake , however , when I try to run it with a number of checkerboard snapshots (around 13 photos) to calibrate my IPhone camera : The program goes very well but gets crashed at the line # 362

Here is the output of I got in my terminal :

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: Bad argument (Unknown array type) in cvarrToMat, file /tmp/opencv-EKIKs8/opencv-2.4.9/modules/core/src/matrix.cpp, line 698
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv-EKIKs8/opencv-2.4.9/modules/core/src/matrix.cpp:698: error: (-5) Unknown array type in function cvarrToMat

Abort trap: 6

I really appreciate any help

edit retag flag offensive close merge delete

Comments

I checked if the current 2.4 branch has an updated version but it seems to be the same as the fossies one. Basically the error states that one of the input elements of the initUndistortRectifyMap() is empty or non existing. So the code successfully grabs all your calibration images but then does something wrong. Can you run a debug session on your side and check if all input arguments of that function actually have values?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-28 03:33:40 -0600 )edit

Hello! I faced same problems. How can you solve them? I tried everything in google...

Dasom gravatar imageDasom ( 2016-10-17 18:04:35 -0600 )edit

I am also having the same problem :( I am using an 11x4 asymmetric circles grid. No clue what's going wrong.

mannyglover gravatar imagemannyglover ( 2016-11-14 15:47:18 -0600 )edit

3 answers

Sort by ยป oldest newest most voted
1

answered 2015-02-09 01:55:15 -0600

_Student_ gravatar image

updated 2015-02-09 02:59:24 -0600

The answer is :

in configuration file , we should have these values or less :

 <BoardSize_Width> 6</BoardSize_Width>
 <BoardSize_Height>8</BoardSize_Height>

these values mean how many corners (cross points ) we have in the checkerboard in the width and the height , see the the width and the height in the attached image are circled . C:\fakepath\yike4dRrT.png

edit flag offensive delete link more

Comments

I am sorry but could you try to explain better why these values are necessary or why it didnt work with your input images. You used another checkerboard pattern than the one supplied with OpenCV?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-02-09 02:31:51 -0600 )edit
1

I used the same checkerboard supplied with OpenCV (I took several images of the same checkerboard from different distances , angles ,,etc ) . It was not working with me because I put more than 6 and 8 which are more than the corners (cross points) in the image . In another words , the width should be the same cross points in the width or less and the height should be the same cross points in the height .

_Student_ gravatar image_Student_ ( 2015-02-09 02:47:53 -0600 )edit
0

answered 2015-04-12 11:49:27 -0600

I got the same error, and it occurred because OpenCV was unable to find the provided images. Make sure that the relative path is correct (I believe, it expects paths relative to the running directory).

edit flag offensive delete link more
0

answered 2016-11-15 09:44:30 -0600

mannyglover gravatar image

updated 2016-11-15 09:44:59 -0600

Switch length and width. I ended up just switching the length and width numbers in the input xml file, and it ended up working. Initially, I was getting a funky undistorted image, but I set all the following constraints to zero (false):

  <!-- 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>

and then it worked correctly.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-01-28 02:48:16 -0600

Seen: 13,527 times

Last updated: Nov 15 '16