# Calibrate lens gui

From PanoTools.org Wiki

calibrate_lens_gui is a tool for lens calibration using the straight line approach.

# Workflow

1. Load images

2. Check focal length and crop factor (calibrate_lens_gui tries to read them from the EXIF data)

3. Detect lines

4. Optimize the lens parameters

5. Save optimized lens parameters into file for using inside Hugin

# Line detection

To speed up the following calculations the image is scaled down, so that the longest dimension of the image is smaller than maximal image size.

Then an edge detection operator is applied. The Canny edge detector is used for this. This step can be tuned with the scale or radius factor and the threshold for the Canny edge detector.

Finally the found lines are checked if they are straight in respect to the given focal length. Also lines which are shorter than the minimal line length are rejected. Minimum line length is given as ratio to the image width/height. So a value of 0.3 means that only lines which are longer than 30 % of the image width are used.

# Preview

- Original: Shows the original image as loaded from the disc.
- Edge detection: Shows the result of the Canny edge detector. Useful for tweaking the scale and threshold parameters that good lines are found.
- Corrected: Shows the image corrected with the current lens parameters. If you manually edit these values you need to press Refresh so see the effect of the modified parameters.

Show lines: This will blend the detected lines into the image. Valid lines are drawn in green. Invalid lines (e.g. too short or too curved) are drawn in black - these lines are not always visible.

With the left mouse button you can mark lines to be not used for the optimisation (e.g. if the automatic detection was not perfect and selected also bad lines). Lines which are ignored by the the optimiser are drawn in red. If you want these lines to be used by the optimiser again click with the right mouse button on these lines.

Retrieved from "https://wiki.panotools.org/index.php?title=Calibrate_lens_gui&oldid=16084"