# camera_calib_matlab
This is a camera calibration toolbox. It's partly based on [Bouguet's toolbox](http://www.vision.caltech.edu/bouguetj/calib_doc/) and Zhang's camera calibration paper, but with more functionality:
* Setup is based on an input configuration file which allows for easy tweaking and modification of algorithms and allows for greater reproducibility. If you save the images, configuration file, and script, the calibration will be repeatable.
* Includes fiducial marker recognition which makes the calibration fully automatic.
* The distortion function is input as a symbolic function (via configuration file) and is therefore very easily modifiable. Two distortion functions are provided already ("heikkila97" and "wang08"); this toolbox uses symbolic differentiation to compute the updated jacobians/hessians/gradients automatically.
* Supports multi-camera calibration.
* Implements both "distortion refinement" and "frontal refinement" techniques.
* Supports multiple calibration board targets (checkers, circles, etc...) and correctly accounts for "center of ellipse" vs "projected center of circle" for circular targets depending on the type of calibration (i.e. "frontal refinement" or "distortion refinement").
* Supports custom calibration board geometries by overriding an abstract calibration board geometry class.
* Supports (optional) covariance optimization (i.e. generalized least squares) based on uncertainties computed during target localization.
* Supports calibration board going partially "out of frame" which improves robustness and allows for bigger calibration boards to be used.
* Code is organized, documented, and utilizes object oriented principles for code reuse.
# Installation instructions:
1) Clone the repo:
```
git clone https://github.com/justinblaber/camera_calib_matlab.git
```
# Example:
1. First, download images/config/script from [here](http://justinblaber.org/downloads/github/camera_calib/dotvision_checker.zip).
2. Unzip, navigate to the folder in matlab, and check the configuration script, `dotvision_checker.conf`:
```
% Checkerboard target
target = checker
target_optimization = edges
% Checkerboard geometry
height_cb = 50.8
width_cb = 50.8
num_targets_height = 16
num_targets_width = 16
target_spacing = 2.032
height_fp = 42.672
width_fp = 42.672
obj_cb_geom = class.cb_geom.csgrid_cfp
% Optimization
calib_optimization = distortion_refinement
% Plotting
camera_size = 20
```
The targets are checkers and the target optimization is a cool "edges" refinement algorithm from Mallon07. The calibration board geometry class used is "csgrid_cfp" which is a centered square grid with centered "four point" fiducial markers.
3. Next, open the `dotvision_checker.m` script in matlab, which should include:
```
clear; clc;
% Read calibration config
calib_config = intf.load_calib_config('dotvision_checker.conf');
% Set images
path_cbs(:,1) = {
'SERIAL_19061245_DATETIME_2019-05-30-01:17:49-279539_CAM_1_FRAMEID_0_COUNTER_1.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:19:10-092852_CAM_1_FRAMEID_0_COUNTER_2.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:20:05-049316_CAM_1_FRAMEID_0_COUNTER_3.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:20:53-252540_CAM_1_FRAMEID_0_COUNTER_4.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:21:26-059003_CAM_1_FRAMEID_0_COUNTER_5.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:22:22-406834_CAM_1_FRAMEID_0_COUNTER_6.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:22:55-725990_CAM_1_FRAMEID_0_COUNTER_7.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:23:34-075146_CAM_1_FRAMEID_0_COUNTER_8.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:24:13-309275_CAM_1_FRAMEID_0_COUNTER_9.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:24:50-385473_CAM_1_FRAMEID_0_COUNTER_10.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:25:35-707981_CAM_1_FRAMEID_0_COUNTER_11.png', ...
'SERIAL_19061245_DATETIME_2019-05-30-01:26:07-053008_CAM_1_FRAMEID_0_COUNTER_12.png'
};
path_cbs(:,2) = {
'SERIAL_16276941_DATETIME_2019-05-30-01:17:49-279573_CAM_2_FRAMEID_0_COUNTER_1.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:19:10-092894_CAM_2_FRAMEID_0_COUNTER_2.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:20:05-049342_CAM_2_FRAMEID_0_COUNTER_3.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:20:53-252565_CAM_2_FRAMEID_0_COUNTER_4.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:21:26-059023_CAM_2_FRAMEID_0_COUNTER_5.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:22:22-406855_CAM_2_FRAMEID_0_COUNTER_6.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:22:55-726022_CAM_2_FRAMEID_0_COUNTER_7.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:23:34-075170_CAM_2_FRAMEID_0_COUNTER_8.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:24:13-309309_CAM_2_FRAMEID_0_COUNTER_9.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:24:50-385500_CAM_2_FRAMEID_0_COUNTER_10.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:25:35-708005_CAM_2_FRAMEID_0_COUNTER_11.png', ...
'SERIAL_16276941_DATETIME_2019-05-30-01:26:07-053021_CAM_2_FRAMEID_0_COUNTER_12.png', ...
};
path_cbs(:,3) = {
'SERIAL_16276942_DATETIME_2019-05-30-01:17:49-279580_CAM_3_FRAMEID_0_COUNTER_1.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:19:10-092897_CAM_3_FRAMEID_0_COUNTER_2.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:20:05-049351_CAM_3_FRAMEID_0_COUNTER_3.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:20:53-252567_CAM_3_FRAMEID_0_COUNTER_4.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:21:26-059040_CAM_3_FRAMEID_0_COUNTER_5.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:22:22-406871_CAM_3_FRAMEID_0_COUNTER_6.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:22:55-726019_CAM_3_FRAMEID_0_COUNTER_7.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:23:34-075180_CAM_3_FRAMEID_0_COUNTER_8.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:24:13-309307_CAM_3_FRAMEID_0_COUNTER_9.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:24:50-385526_CAM_3_FRAMEID_0_COUNTER_10.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:25:35-708001_CAM_3_FRAMEID_0_COUNTER_11.png', ...
'SERIAL_16276942_DATETIME_2019-05-30-01:26:07-053028_CAM_3_FRAMEID_0_COUNTER_12.png', ...
};
% Validate all calibration board images
img_cbs = intf.validate_multi_path_imgs(path_cbs);
% Display calib config
intf.plot_cb_geom(calib_config);
% Detect four points
[p_fpss, debug_fp] = intf.fp_detect(img_cbs, calib_config);
% four point gui
intf.gui_fp_detect(p_fpss, img_cbs, debug_fp, calib_config)
% Perform calibration
calib = intf.calib_fp(img_cbs, p_fpss, calib_config);
% Calib gui
intf.gui_calib(calib);
```
Make sure to first add the library to path with something like: `addpath('~/camera_calib')`
After running this script, the first figure to appear should be:
![four point detector](https://i.imgur.com/mTd2DGF.png)
This gui is useful for debugging the detection of the four fiducial markers. You can toggle through the images by pressing the left and right arrow keys.
The next figure should be:
![calibration](https://i.imgur.com/yjqjuBV.png)
This gui is useful for debugging the calibration. The first thing to do is to double check the calibration board geometry to make sure it's correct. Next, check the residuals to make sure they are reasonably small. I would also rotate the extrinsics to confirm the relative pose of the cameras makes sense. Lastly, you can toggle "w" and zoom into the calibration point with the largest residual.
没有合适的资源?快使用搜索试试~ 我知道了~
Camera calibration with matlab.zip
共281个文件
m:238个
jpg:16个
mat:14个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 21 浏览量
2023-07-23
10:09:25
上传
评论
收藏 19.54MB ZIP 举报
温馨提示
Camera calibration with matlab.zip
资源推荐
资源详情
资源评论
收起资源包目录
Camera calibration with matlab.zip (281个子文件)
checker_dr.conf 925B
checker_fr.conf 922B
circle_dr.conf 822B
circle_fr.conf 819B
stereo.conf 505B
marker.conf 358B
.gitignore 3B
2.jpg 141KB
1.jpg 129KB
1.jpg 123KB
3.jpg 121KB
3.jpg 113KB
2.jpg 112KB
left03.jpg 29KB
left05.jpg 28KB
right03.jpg 28KB
left02.jpg 28KB
left01.jpg 27KB
right02.jpg 27KB
right01.jpg 26KB
right05.jpg 26KB
left04.jpg 25KB
right04.jpg 24KB
test_fp_detect_blobs.m 208KB
test_blob_detect_thresh.m 69KB
test_blob_detect_LoG.m 65KB
refine_ellipse_dot.m 59KB
refine_ellipse_edges.m 54KB
parse_calib_config.m 28KB
base.m 21KB
fp_detect_blobs.m 16KB
single_calib_H_fr.m 14KB
blob_detect_LoG.m 14KB
single_calib_H_dr.m 11KB
gui_fp_detect.m 9KB
base.m 9KB
gui_calib.m 8KB
multi_calib_H.m 8KB
refine_ellipse_point.m 7KB
refine_checker_point.m 7KB
refine_checker_edges.m 6KB
distinguishable_colors.m 6KB
test_multi_calib_H.m 5KB
read_data.m 5KB
plot_cam_3D.m 5KB
run_unit_tests.m 5KB
test_single_calib_H_dr.m 5KB
lmcov.m 5KB
test_single_calib_H_fr.m 5KB
calib_fp.m 5KB
dp_2_dH_c2e.m 5KB
path.m 4KB
dominant_grad_angles.m 4KB
blob_detect_thresh.m 4KB
write_single_cam.m 4KB
dp_2_dp_1_c2e.m 4KB
parse_single_cam.m 4KB
test_refine_ellipse_point.m 4KB
refine_ring_point.m 4KB
cdgrid.m 3KB
ellipse.m 3KB
test_write_single_cam.m 3KB
refine_target_points_cb_w2p.m 3KB
csgrid.m 3KB
test_refine_checker_point.m 3KB
homography_c2e_nonlin.m 3KB
homography_p2p_nonlin.m 2KB
fp_detect.m 2KB
plot_multi_extrinsics.m 2KB
conic2ellipse.m 2KB
write_data.m 2KB
apply_homography_c2e.m 2KB
create_marker_templates.m 2KB
init_intrinsic_params.m 2KB
fit_conic.m 2KB
safe_lscov.m 2KB
plot_calib_cb_img.m 2KB
test_apply_homography_c2e.m 2KB
line_bb_intersect.m 2KB
homography_p2p_lin.m 2KB
refine_ring_opencv.m 2KB
plot_cb_geom.m 2KB
dp_2_dH_p2p.m 2KB
test_normalize_array.m 2KB
homography_c2e.m 2KB
dp_2_dp_1_p2p.m 1KB
custom.m 1KB
test_ellipse2xform.m 1KB
dR_deuler.m 1KB
cfp.m 1KB
refine_checker_opencv.m 1KB
heikkila97.m 1KB
wang08.m 1KB
test_parse_single_cam.m 1KB
test_asymptotes.m 1KB
load_calib_config.m 1KB
test_read_data.m 1KB
cb_w2p_c2e.m 1KB
homography_p2p.m 1KB
load_calib.m 1KB
共 281 条
- 1
- 2
- 3
资源评论
AbelZ_01
- 粉丝: 883
- 资源: 5441
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功