Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
agnivsen opened this issue Jun 3, 2016 · 1 comment

Comments

@agnivsen
Copy link

agnivsen commented Jun 3, 2016

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:

  • CAMERA_DIST_CENTER
  • CAMERA_DIST_PARAM
  • CAMERA_READOUT

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

  • Fg,
  • offset
  • rot_x
  • rot_y
  • rot_z
  • gbias_x
  • gbias_y
  • gbias_z

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

@hovren
Copy link
Owner

hovren commented Aug 22, 2016

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

  • Bad camera calibration
  • Bad video quality or bad scene (i.e. too few points to track)
  • Guessed gyroscope rate is too far from the correct value.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants