Difference between revisions of "How to Calibrate Camera Optics"
(scales comparison) |
m |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 15: | Line 15: | ||
* Mark camera by some label to distinguish it from others. | * Mark camera by some label to distinguish it from others. | ||
| + | : For example: | ||
| + | <center>[[File:action-cameras-labels-sample.jpg|400px]]</center> | ||
* Set view-angle and resolution you're going to use during motion capture session(s). | * Set view-angle and resolution you're going to use during motion capture session(s). | ||
| − | + | : {{Tip|720p (1280 x 720) resolution is recommended for full body motion capture needs in most cases (except very large capture area).}} | |
| − | + | : {{Important|If you use [https://shop.gopro.com/cameras GoPro] action camera, please don't use [https://gopro.com/help/articles/question_answer/What-is-SuperView SuperView] mode because in this mode calibration will fail (thanks to special "dynamic stretches" from 4:3 to 16:9 format made by camera software).}} | |
* If your camera has zoom and/or auto-focus features then these features must be turned off before calibration because this procedure is valid only for fixed optics. | * If your camera has zoom and/or auto-focus features then these features must be turned off before calibration because this procedure is valid only for fixed optics. | ||
* Run [[iPi Recorder]] and click '''Calibrate Camera Optics''' button in toolbar: | * Run [[iPi Recorder]] and click '''Calibrate Camera Optics''' button in toolbar: | ||
| Line 24: | Line 26: | ||
* Click '''Show Pattern''' button in toolbar of '''PATTERN''' tab of '''Camera Optics Calibration''' tool: | * Click '''Show Pattern''' button in toolbar of '''PATTERN''' tab of '''Camera Optics Calibration''' tool: | ||
<center>[[File:camera-calibration-show-pattern-button.png|link=]]</center> | <center>[[File:camera-calibration-show-pattern-button.png|link=]]</center> | ||
| − | * Start video recording and shoot this pattern from different view | + | * Start video recording and shoot this pattern from different view points. For each view: |
** Ensure the pattern fills most of the frame. It's OK if the whole screen doesn't feet into the frame. | ** Ensure the pattern fills most of the frame. It's OK if the whole screen doesn't feet into the frame. | ||
** Hold the camera still for a second. | ** Hold the camera still for a second. | ||
| − | * We recommend to use the following five view | + | * We recommend to use the following five view points: |
<center><table border=0> | <center><table border=0> | ||
| − | <tr><td>'''View | + | <tr><td>'''View Point'''</td> |
<td align="center">'''How it Looks from Side'''</td> | <td align="center">'''How it Looks from Side'''</td> | ||
<td align="center">'''How it Looks from Top'''</td> | <td align="center">'''How it Looks from Top'''</td> | ||
| Line 77: | Line 79: | ||
<center>[[File:camera-calibration-open-video-button.png|link=]]</center> | <center>[[File:camera-calibration-open-video-button.png|link=]]</center> | ||
* Video will be automatically converted to internal [[.iPiVideo File Extension|.iPiVideo]] file format. | * Video will be automatically converted to internal [[.iPiVideo File Extension|.iPiVideo]] file format. | ||
| − | * Using "Toggle Current Frame" button in toolbar choose frames with different view | + | * Using "Toggle Current Frame" button in toolbar choose frames with different view points: |
** where the pattern fills most of the frame | ** where the pattern fills most of the frame | ||
** where camera is not moving significantly | ** where camera is not moving significantly | ||
| − | ** one frame for each view | + | ** one frame for each view point type is enough |
* Application will show detected markers in selected frame. It's OK if some of markers weren't detected. | * Application will show detected markers in selected frame. It's OK if some of markers weren't detected. | ||
** If you don't like results of detection, you can deselect the frame by clicking '''Toggle Current Frame''' button again and try different frame(s) from video. | ** If you don't like results of detection, you can deselect the frame by clicking '''Toggle Current Frame''' button again and try different frame(s) from video. | ||
<center>[[File:camera-calibration-frames-selection.png|800px]]</center> | <center>[[File:camera-calibration-frames-selection.png|800px]]</center> | ||
| − | * As soon as you choose at least three frames (we recommend to use five frames corresponding to five view | + | * As soon as you choose at least three frames (we recommend to use five frames corresponding to five view point types described above) you can run calculation of camera optics parameters by clicking on '''Run Calibration''' button in toolbar. |
** Also, you can change calibration options using controls located near this button. But in most cases default values work like a charm. | ** Also, you can change calibration options using controls located near this button. But in most cases default values work like a charm. | ||
* Now you're on '''RESULT''' tab and see calculated parameters of camera optics: | * Now you're on '''RESULT''' tab and see calculated parameters of camera optics: | ||
<center>[[File:camera-calibration-results-tab.png|600px]]</center> | <center>[[File:camera-calibration-results-tab.png|600px]]</center> | ||
| − | {{Tip|You can play with sample calibration video: [http://files.ipisoft.com/samples4/four-gopro/internal-calib/cam1-720p-wide.MP4 cam1-720p-wide.MP4] (13 MB). We recommend to choose the following frames: <tt>50</tt> ("front" view | + | {{Tip|You can play with sample calibration video: [http://files.ipisoft.com/samples4/four-gopro/internal-calib/cam1-720p-wide.MP4 cam1-720p-wide.MP4] (13 MB). We recommend to choose the following frames: <tt>50</tt> ("front" view point), <tt>880</tt> ("from the left" view point), <tt>1360</tt> ("from the right" view point), <tt>1780</tt> ("from the top" view point), <tt>2110</tt> ("from the bottom" view point).}} |
| − | == | + | == Undistorting and Scale == |
Camera parameters are used to remove distortion from video. This allows to process video in [[iPi Mocap Studio]] just like video from web-camera with good optics (without significant distortion and principal point shift). | Camera parameters are used to remove distortion from video. This allows to process video in [[iPi Mocap Studio]] just like video from web-camera with good optics (without significant distortion and principal point shift). | ||
| Line 125: | Line 127: | ||
<td></td> | <td></td> | ||
<td align="center" valign="top">Almost all pixels from original image present on undistorted one (result/effective FOV is about the same as original FOV) but effective vertical resolution on undistorted image is too low (as a result we loose detailing for objects near the center).</td> | <td align="center" valign="top">Almost all pixels from original image present on undistorted one (result/effective FOV is about the same as original FOV) but effective vertical resolution on undistorted image is too low (as a result we loose detailing for objects near the center).</td> | ||
| − | <td align="center" valign="top">Looks as a reasonable balance between | + | <td align="center" valign="top">Looks as a reasonable balance between loss in FOV and loss in vertical resolution.</td> |
<td align="center" valign="top">There is no green areas on undistorted image but we loose a lot of pixels from original image (result/effective FOV is too small in comparison with original one).</td> | <td align="center" valign="top">There is no green areas on undistorted image but we loose a lot of pixels from original image (result/effective FOV is too small in comparison with original one).</td> | ||
</tr> | </tr> | ||
</table></center> | </table></center> | ||
| + | |||
| + | {{Note|If needed this scale can be adjusted later in '''Combined Video Builder''' tool. See [[How to Build Synced Multi-Camera Video]] for details.}} | ||
| + | |||
| + | == Result == | ||
| + | |||
| + | * Save parameters of camera to <tt>.iPiCam</tt> file on disc by clicking on '''Save''' button in toolbar. | ||
| + | ** {{Tip|We recommend to name file using camera nickname/label, resolution and FOV setting. For example: <tt>cam1-720p-wide.iPiCam</tt>, where <tt>1</tt> is label on camera, <tt>720p</tt> — video resolution setting, <tt>wide</tt> — view/FOV setting. This would help to choose and apply right camera parameters to undistort video in '''Combined Video Builder''' tool.}} | ||
| + | * You'll use this file later — during creation of synchronized multi-camera video from individual MP4/AVI/MOV/MPEG video files from cameras. See [[How to Build Synced Multi-Camera Video]] for details. | ||
| + | |||
| + | |||
| + | <hr> | ||
| + | |||
| + | |||
| + | Repeat the overall procedure for each camera you're going to use in your motion capture session. | ||
Latest revision as of 11:16, 13 August 2018
Contents
Introduction
Calibration of camera optics is required to find out the values of the following intrinsic parameters:
- Focal length
- Shift of camera principal point from the center of image
- Radial distortion parameters (2 — 4 coefficients)
- Pixel aspect ratio (optional)
- Pixel shear (optional)
This procedure is strongly mandatory for modern wide-angle cameras including action cameras. The thing is that these cameras has significant distortion.
Recording of Calibration Video
- Mark camera by some label to distinguish it from others.
- For example:
- Set view-angle and resolution you're going to use during motion capture session(s).
- Tip: 720p (1280 x 720) resolution is recommended for full body motion capture needs in most cases (except very large capture area).

- If your camera has zoom and/or auto-focus features then these features must be turned off before calibration because this procedure is valid only for fixed optics.
- Run iPi Recorder and click Calibrate Camera Optics button in toolbar:

- To calibrate camera optics special calibration pattern is used. You have to record this pattern shown on computer screen from different view points.
- Click Show Pattern button in toolbar of PATTERN tab of Camera Optics Calibration tool:

- Start video recording and shoot this pattern from different view points. For each view:
- Ensure the pattern fills most of the frame. It's OK if the whole screen doesn't feet into the frame.
- Hold the camera still for a second.
- We recommend to use the following five view points:
| View Point | How it Looks from Side | How it Looks from Top | How it Looks in Camera |
| 1. Front | |||
| 2. From the left | |||
| 3. From the right | |||
| 4. From the top | |||
| 5. From the bottom | |||
Processing of Calibration Video
- Copy recorded MP4/AVI/MOV/MPEG video file to computer.
- The best option here is to use SD-card reader. But USB cord also do the trick but slower.
- Switch to CALIBRATION tab in Camera Optics Calibration tool in iPi Recorder and open this video by clicking Open Video button in toolbar:

- Video will be automatically converted to internal .iPiVideo file format.
- Using "Toggle Current Frame" button in toolbar choose frames with different view points:
- where the pattern fills most of the frame
- where camera is not moving significantly
- one frame for each view point type is enough
- Application will show detected markers in selected frame. It's OK if some of markers weren't detected.
- If you don't like results of detection, you can deselect the frame by clicking Toggle Current Frame button again and try different frame(s) from video.
- As soon as you choose at least three frames (we recommend to use five frames corresponding to five view point types described above) you can run calculation of camera optics parameters by clicking on Run Calibration button in toolbar.
- Also, you can change calibration options using controls located near this button. But in most cases default values work like a charm.
- Now you're on RESULT tab and see calculated parameters of camera optics:
Undistorting and Scale
Camera parameters are used to remove distortion from video. This allows to process video in iPi Mocap Studio just like video from web-camera with good optics (without significant distortion and principal point shift).
On the RESULT tab you can click on some frame in left panel and get preview of distortion removing ("undistorting"):

As you can see, there is a big difference in geometry of boundaries because of radial distortion. As a result, part of pixels from original (top) image are not visible in undistorted (bottom) image. And in turn, on undistorted (bottom) image there are areas filled by green color: the thing is that, corresponding pixels on source (i.e. original) image are beyond of boundaries.
Using Scale parameter you can adjust proportion between two quantities:
- how many pixels on original image are beyond boundaries of undistorted image (pixels which lay down out of green-line boundaries on the top image)
- how many pixels on undistorted image have no corresponding (source) ones on original image (green pixels on the bottom image)
By default scale is automatically selected to balance (1) and (2). But you can adjust it manually if needed. But be aware that low values of scale result in degradation of image quality on undistorted video (because pixel size of all objects on video becomes smaller). And high values of scale result in significant narrowing of field-of-view (FOV) after undistorting.
| Scale = 0.65 | Scale = 0.80 | Scale = 0.90 | ||||
| Original image |
||||||
| Undistorted image |
||||||
| Almost all pixels from original image present on undistorted one (result/effective FOV is about the same as original FOV) but effective vertical resolution on undistorted image is too low (as a result we loose detailing for objects near the center). | Looks as a reasonable balance between loss in FOV and loss in vertical resolution. | There is no green areas on undistorted image but we loose a lot of pixels from original image (result/effective FOV is too small in comparison with original one). |
Result
- Save parameters of camera to .iPiCam file on disc by clicking on Save button in toolbar.
- Tip: We recommend to name file using camera nickname/label, resolution and FOV setting. For example: cam1-720p-wide.iPiCam, where 1 is label on camera, 720p — video resolution setting, wide — view/FOV setting. This would help to choose and apply right camera parameters to undistort video in Combined Video Builder tool.

-
- You'll use this file later — during creation of synchronized multi-camera video from individual MP4/AVI/MOV/MPEG video files from cameras. See How to Build Synced Multi-Camera Video for details.
Repeat the overall procedure for each camera you're going to use in your motion capture session.