hovren / crisp

Camera-to-IMU calibration and synchronization toolbox
GNU General Public License v3.0
206 stars 74 forks source link

Calibration fails: "Number of calls to function has reached maxfev = 800." #7

Open agnivsen opened 8 years ago

agnivsen commented 8 years ago

Trying to calibrate camera - gyroscope pair. Camera runs at 30 fps, Gyro at 100 Hz.

The example file 'gopro_dataset_example.py', when modified to suit our dataset, runs for 2 - 3 minutes and fails with the following message:

runfile('/crisp/gopro_dataset_example.py', args='/Set3/set3.mov', wdir='/crisp')
Creating video stream from /Set3/set3.mov
Creating gyro stream from /Set3/set3_gyro.csv
Post processing L3G4200D gyroscope data to remove frequency spike noise
Creating calibrator
Estimating time offset and camera to gyroscope rotation. Guessing gyro rate = 100.00
Running calibration. This can take a few minutes.
Calibration failed. Reason "Number of calls to function has reached maxfev = 800."
/crisp/gopro_dataset_example.py:101: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  print('Calibration failed. Reason "{}"'.format(e.message))
To exit: use 'exit', 'quit', or Ctrl-D.
An exception has occurred, use %tb to see the full traceback.

SystemExit: -2

Traceback:

Traceback (most recent call last):

  File "<ipython-input-12-64f97a132da6>", line 1, in <module>
    runfile('/crisp/gopro_dataset_example.py', args='/Set3/set3.mov', wdir='/crisp')

  File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 714, in runfile
    execfile(filename, namespace)

  File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
    builtins.execfile(filename, *where)

  File "/crisp/gopro_dataset_example.py", line 102, in <module>
    sys.exit(-2)

SystemExit: -2

In the example python file, there are quite a few parameters which are not very obvious:

Care to explain these ones:

Also, in the *_reference.csv, please explain these column headers:

What happens if I do not already know the gyro biases? Do we need to provide an estimate?

hovren commented 8 years ago

Sorry for the super late reply!

Since I don't have any details, the only thing I can get fro the error message is that the calibration fails since it reached the maximum number of allowed iterations. Why this happens could depend on a lot of things, e.g.:

You are also applying the L3G4200D post processing that my gyroscope needs, but yours probably does not.

The CAMERA_XXX constants are parameters for the AtanCameraModel class. You can calibrate your own camera using this model (although that piece of code is not supported in any way) or, if you have already calibrated the camera with the OpenCV camera model, there is also an OpenCvCameraModel class.

The _references.csv header is explained in detail in the README file of the dataset which the example script is made for.

The gyro biases are part of the parameters that are being optimized by the calibrator. Not knowing them is thus fine and normal.