Skip to content

ClarkeAC/CameraCalibrationTool

Repository files navigation

Camera Calibration

USAGE

  1. Preparation:

    1. If there are multiple cameras, fix all cameras that need calibration, and ensure they are rigidly connected.

      • After calibration, the cameras should not be disassembled or repositioned. Even disassembling and restoring them to the original state requires recalibration (as extrinsic parameters may change).
    2. The focal length of the camera should remain fixed.

      • During calibration, focal length should not be adjusted (i.e., no focusing or zooming).

      • It is best to use a fixed-focus camera (no zoom, no focus adjustment, focal length stays constant).

      • If a zoom camera must be calibrated, calibration should be performed separately for different focal lengths (zoom levels) and focus settings. (In theory, cameras without focus breathing can allow focusing, since its effect on focal length can be corrected.)

        • Example: For zoom levels 1, 2, 3, 4 and focus settings 100, 200, 300, 400, calibration should be performed separately. That’s 4 × 4 = 16 calibrations. Assuming 15 photo sets per calibration, 240 sets of photos are required.
    3. Place the calibration board in front of the cameras, ensuring all cameras can see the full board.

    4. Capture images simultaneously with all cameras and save them. One set = one simultaneous capture.

      • File structure:

        • Each camera’s images should be saved in a separate folder.

        • [Optional] Images from the same set but different cameras should have identical filenames to maintain order.

        • Example:

          ├── cameras
          │   ├── camera1
          │   │   ├── image1.jpg
          │   │   └── image2.jpg
          │   └── camera2
          │       ├── image1.jpg
          │       └── image2.jpg
          
    5. Move the calibration board to new positions and repeat until 10–20 sets of photos are obtained.

  2. Run Camera Calibrate.exe or python main.py

    Initial UI

  3. Click Open Folder to select the folder containing images. The folder structure determines whether single-camera or multi-camera calibration is performed. Supported formats: jpg, png, bmp.

    • Multi-camera calibration requires the following folder structure, with identical numbers of images per camera:

      ├── cameras
      │   ├── camera1
      │   │   ├── image1.jpg
      │   │   └── image2.jpg
      │   └── camera2
      │       ├── photo1.jpg
      │       └── photo2.jpg
      
    • Single-camera calibration requires:

      ├── camera
      │   ├── image1.jpg
      │   └── image2.jpg
      
  4. After import, a table appears on the right. For each camera, all images must share the same resolution. The first image defines the standard size; mismatched images are flagged.

    Image table 1

  5. Click Display to browse images. Camera dropdown shows camera name, Batch refers to image index (matching the table).

    • Without Point checked:

      Preview 1

    • With Point checked:

      Preview 2

      Displays control points used in calibration.

  6. Go to the Calibrate tab. Modify Pattern Config to match the calibration board in the images. Control points update in real time in the right-side plot.

    • Chess board: control points = corners of black/white squares. Enabling Auxiliary adds cross markers.

      Chess board

    • Circle grid: control points = circle centers. Enabling Auxiliary adds circle markers.

      Circle grid

    • Options:

      • Type: board type

        • Chess board
        • Circle grid
      • Stagger: only for circle grids

        • N/A
        • Vertical
        • Horizontal
      • Reverse: flips the pattern (x, y)

      • shape: rows × columns of control points

      • size: spacing between control points (chessboard square size, circle grid spacing)

  7. Adjust parameters under Calibrate Config (see Calibration Parameters).

  8. Click Calibrate to start calibration.

    • Camera Matrix Table shows calibration results.

      Results

    • Reprojection Error tab shows error scatter plot.

      Error plot

  9. [Optional] Use Threshold under Reprojection Error to filter out images with high errors.

    Error threshold

    Results update in the table and scatter plot (outliers shown as “x”).

    Error plot 2

  10. 3D Plot tab shows spatial relations between cameras and calibration boards. Left-drag to rotate, right-drag to zoom.

    3D view

    • Equal Aspect: lock axis proportions.
    • Change Axis: reorder axes for easier viewing.
  11. Save results via FileSave. Supported formats: xml, yaml, json (OpenCV format).


Calibration Parameters

Name Board Type Mono/Stereo Meaning
Threshold (Reprojection Error) N/A Mono Threshold
Flag Chessboard Mono flags
Blob Detector Circle grid Mono SimpleBlobDetector::Params
Flag Circle grid Mono flags
Strict Condition (Mono) N/A Mono Strict Condition
Term Criteria N/A N/A TermCriteria
Strict Condition (Stereo) N/A Stereo Strict Condition
Ignore Order N/A Stereo Ignore Order
Focus first camera N/A Stereo Focus first camera

Threshold

Reprojection Error Threshold is only available after at least one calibration. Images exceeding the threshold are skipped in subsequent calibrations.

Blob Detector

BlobTest

Strict Condition (Mono)

A set = images captured simultaneously by all cameras. The set is only valid if all images are usable.

Example: Camera A has a1, a2, a3; Camera B has b1, b2, b3. If a2 is invalid:

  • Checked: A → {a1, a3}, B → {b1, b3}
  • Unchecked: A → {a1, a3}, B → {b1, b2, b3}

Strict Condition (Stereo)

Same as above, extended to stereo/multi-camera groups.

Ignore Order

Use combinations rather than permutations for pairwise calibration.

Focus first camera

Only compute relations between the first camera and all others.


Settings

Modify customConfig.yaml to change log level, console output, theme colors, and default calibration parameters. Flags are annotated from low bit to high bit.

Mapping Relations

Coordinate mapping between two cameras follows:

$$ P_{d} = {1 \over Z_{d}} \cdot K_{d} \cdot (R_{sd} \cdot (Z_{s} \cdot K_{s}^{-1} \cdot P_{s}) - T_{sd}) $$

$$ P_{d} = \begin{bmatrix} u_{d} \\ v_{d} \\ 1 \\ \end{bmatrix} $$

$$ P_{s} = \begin{bmatrix} u_{s} \\ v_{s} \\ 1 \\ \end{bmatrix} $$

where $P_{s}$, $P_{d}$ are pixel coordinates; $K_{s}$, $K_{d}$ intrinsic parameters; $R_{sd}, $T_{sd}$ extrinsics; $Z_{s}, $Z_{d}$ distances to respective image planes.


Generate PDF

docker run --rm -v $(pwd):/data pandoc/extra:3.2.0-ubuntu \
bash -c "apt-get update -qq && apt-get install -y -qq fonts-wqy-zenhei && pandoc --pdf-engine=xelatex -V 'CJKmainfont:WenQuanYi Zen Hei' --template eisvogel --standalone readme.md -o readme.pdf"

Known Issues

  • PDF generated via Help has broken links.

  • On Linux, additional dependencies may be required:

    • libxcb-xinerama0
    • mesa-utils
    • libgl1-mesa-glx

TODO

  • UI optimization (progress bar, etc.)
  • Circle grid parameter refinement (large variation in dot size limits)
  • Real-time blob tuning for multi-camera calibration (display inertia/convexity/circularity histograms)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages