Extending Camera Database

This part of RC Help tutorials covers how to add a new camera into the database and how to define optical distortion.
The camera database holds various camera properties, such as camera sensor size or lens distortion parameters. It helps in resolving prior camera parameters when image metadata is incomplete, e.g., it does not have a 35mm equivalent focal length. Also, it is used to set proper lens distortion priors to cameras with excessive lens distortion, such as GoPro.
We recommend adding or modifying the existing camera information if you know what you are doing and also to do it in a controlled environment to achieve the best results.


When Should I Add a Camera Database Entry?

It is not necessary to add every camera to the database. If a camera stores the 35mm equivalent focal length into an image file (e.g. EXIF or XMP), the application will read it from there. You should add entry if:


Procedure - Higher Lens Distortion

Follow these instructions to add a new camera to the camera database. If your images do not suffer with a visible lens distortion and you would like to get rid of the yellow exclamation mark, then scroll down to the Camera Sensor Size and just define a proper chip size.

  1. Take some photographs of a box covered in newspaper (something with a lot of texture so that the images are broadly covered with natural feature points) and load them into a new project.
  2. Set Prior lens distortion / Prior to Unknown, since great distortion is expected. It can be set when selecting an image or more of them in the 1Ds panel.

    Prior-lens-distortion-new-camera
  3. Group the cameras in order to make the scene better conditioned. Click Group in the Inputs panel which shows up when clicking once on the Images root in the 1Ds panel (see the screenshot below). For more information on grouping, check Camera Settings.

    Images-Inputs
  4. To make it easier, select the Division lens model, which has only one parameter to set, compared to other distortion models. You can find it in ALIGNMENT tab / Settings / Advanced / Distortion model. For more information about distortion models click here. If you want to create hard priors (i.e. of exact quality), then we recommend using richer lens models, such as Brown3, Brown4, Brown3 with tangential2, or Brown4 with tangential2.
  5. Proceed with ALIGNMENT tab / Align Images (F6).
  6. Have a look at the optics' parameters: either in any 2Ds image view (focal and λ) or in the 1Ds, 2Ds, or 1D panel under Registration part / Calibration.
  7. Open the "sensorsdb.xml" file, which is located in ProgramData on the Windows system drive, which is typically located in C:\\ProgramData\Capturing Reality\RealityCapture\sensorsdb.xml. Add a new item and define these parameters of the new camera: the camera model name and numbers from step no. 6, focal and c1 (camera distortion). Do not forget to save changes.

    sensorsdb

The system will set camera priors automatically this step onwards.


Camera Database File

Camera database is an XML file with a human-readable structure. It is structured as seen in the picture below. The camera entry defines a camera model, camera basic properties such as sensor size and lens properties for different vendors and different focal length.

sensorsdb-xml-structure

Camera Sensor Size

As an example, take iPhone 4 camera. iPhone 4 stores into metadata focal lengths in units relative to its sensor size. To calculate a 35mm equivalent, we need to know the real sensor size. This entry gives this information and it helps calculate the 35mm equivalent focal length. Some cameras also include a chip size in image metadata. In such case RealityCapture can calculate the 35mm focal length even without a camera database.

sensorsdb-iphone-entry

TIPS:

  • RealityCapture displays a camera model in the 1D and 1Ds image/selection panels.
  • Search the Internet for the camera chip size. Camera vendors make this information available.
  • Define a ccdWidth to get rid of the yellow exclamation mark.

Ignore exif GPS

If an image includes GPS coordinates in the exif, it is possible to turn on/off their use per camera.

sensorsdb-xml-ignoreExifGPS

Lens Distortion

The camera database allows defining lens priors. The system automatically reads them when an image is imported and sets them to images.


Exact or Soft Prior?

By default, RealityCapture sets priors from the camera database as a soft prior. It means that the system will optimize their values to get a more precise result. In such case you need just a rough estimate of parameters and a single-parameter division model is a very good choice for this.

Alternatively, you can define exact - hard priors. The system will not change this value further. This is recommended for fixed setups. To define an exact prior, add quality="exact" to the lens model attributes:

sensorsdb-exact-lens

See also: