-
Notifications
You must be signed in to change notification settings - Fork 64
Example: finding camera lens intrinsics
This document is intended as a reference on how to calibrate a camera lens using programs in sltk.
Lens calibration involves displaying sequences of black and white patterns on e.g. an LCD monitor, capturing images of each displayed pattern with the camera, and processing each sequence of captured images into camera-display correspondence data. Ideally, a secondary monitor can be used to display structured light patterns so that the camera live view may be observed on the main monitor.
If everything goes well, the intermediate output will be data saying "monitor pixel (102,600) was seen at camera pixel (231,402)" for many pairs of points, which will be passed to slcalibrate to calculate camera calibration (camera matrix, distortion,..). The monitor is the calibration object, and the pixel pitch is the distance from feature to feature.
Programs used for camera calibration:
- sldisp
- guppy_cap
- slcrunch
- slcalibrate
Procedure:
- Launch sldisp, drag window to output display, and press 'f' to enable fullscreen output.
- Launch guppy_cap, use live camera view to focus camera on flatscreen monitor. Try to fill as much of the camera's field of view with the display as possible.
- Press the return key in guppy_cap to initiate a capture sequence.
- Reposition the monitor relative to the camera, ideally avoiding adjustments to focus.
- Repeat steps 3-4 until enough views have been captured (in practice, 4-5 with large variation in angle provide good results)
- Run slcrunch on each sequence file list (cap_XX/list.yaml) to get correspondence output files (slscan_XXXX.yaml).
- Run list_creator to generate a list (chesslist.yaml) of correspondence files to be used for calibration.
- Run slcalibrate using the list of correspondence data (chesslist.yaml).
- Save calibration_XXXX.yaml to desired location.
Notes:
When running slcrunch for camera calibration, it's best to use the -st <subsample_type> and -sf <subsample_factor> options to subsample the correspondence data. Calibration can take extremely long with no subsampling. Example arguments: "-st point -sf 32" or "-st grid -sf 64". The below images show visualizations (-vis option) of some correspondence data using grid subsampling:

Below are examples of captured images of the highest frequency x and y (respectively) patterns shown on a monitor. Note that at full zoom, each monitor pixel is observed by multiple camera pixels.
