相机+投影仪系统标定
写在前面
1.写的比较详细,所以拆分成几部分。
2.使用Matlab添加额外的工具箱完成标定。
3.使用棋盘格标定相机、投影仪。
- 标定工具下载地址
1.相机标定工具箱Bouguet’s Calibration Toolbox ,详细使用说明见Camera Calibration Toolbox for Matlab
2.投影仪标定工具箱,详细使用说明见论文 Falcao G , Hurtos N , Massich J . Plane-based calibration of a projector-camera system[J]. Vibot Master, 2008, 9.
文章目录
1.标定工具箱的配置
- 1.将下载的2个压缩文件解压,移动到MATLAB安装路径下的toolbox中。
- 2.打开MATLAB,点击设置路径
- 3.在路径设置窗口中点击添加文件夹,分别选中刚才移动到toolbox中的工具箱文件夹,再点击添加并包含子文件夹然后点击保存,关闭。
2.拍摄标定数据图像
制作一个大的标定板,在标定板左侧粘贴上棋盘格,右侧预留出足够的空间作为投影仪投射棋盘格图像的承载幕布。打开投影仪投射棋盘格图案,变换标定板的位置,拍摄10组以上的图像数据,图像数据要求图中2个棋盘格都足够清晰(我这个是反面教材,不够清晰,但是标定板制作的样式就这样,左侧粘贴棋盘格,右侧投影棋盘格)。
将相机拍摄的图像保存名称为image_.jpg image_2.jpg image_3.jpg ...
图片格式都可以,名称前面部分要相同,后缀应为小写英文字母,将图像保存到一个文件夹中,将文件夹路径添加到Matlab路径。
3.标定工具箱使用
在Matlab命令行窗口输入cam_proj_gui
会打开Camera Projector Calibration Toolbox
点击Camera Calibration Gui
会打开刚才添加进matlab中的相机标定工具箱
1.相机标定
首先进行相机标定,相机标定参见使用[Bouguet’s Calibration Toolbox]工具箱进行相机标定->从2.读取图像开始进行相机标定
2.投影仪标定
1.加载相机标定结果
完成相机标定后关闭Camera Calibration Toolbox工具箱就可以,此时回到Camera Projector Calibration Toolbox工具箱,点击Load Camera Calibration
加载刚才完成的相机标定结果。
2.选择投影仪标定图像
然后再点击Set Projector's calib. Images
Matlab命令行显示
Do you want use the same images used for camera calibration to calibrate the projector? ([]=yes, other=no)
因为我们在制作标定板时,实际棋盘格与投影棋盘格在一个图像中,所以在此处我们直接按回车
,选择默认的yes就可以,如果输入其他任何字母,则会选择no。(这里有两种情况,下面只介绍选择yes的情况)
继续点击Ray plane intersection
,Matlab命令行显示
his function is useful to select a subset of images to calibrate
There are currently 16 active images selected for calibration (out of 16):
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
You probably want to suppress images
Number(s) of image(s) to suppress ([] = no image) =
选择默认全部图像进行投影仪的标定,直接回车
就可以。之后Matlab命令行显示
No image has been suppressed. No modication of the list of active images.
There is now a total of 16 active images for calibration:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
You may now run 'Calibration' to recalibrate based on this new set of images.
Window size for corner finder (wintx and winty):
wintx ([] = 5) =
3.提取网格角点
此部分操作流程与相机标定时提取网格角点内容一致,请参见使用[Bouguet’s Calibration Toolbox]工具箱进行相机标定->3.提取网格角点:。
4.进行投影仪标定
点击标定工具箱中Calibrate the projector
进行投影仪标定,Matlab输出标定结果
Aspect ratio optimized (est_aspect_ratio = 1) -> both components of fc are estimated (DEFAULT).
Principal point not optimized (center_optim=0). Note: to set it in the middle of the image, clear variable cc, and run calibration again.
Skew not optimized (est_alpha=0) - (DEFAULT)
Distortion not fully estimated (defined by the variable est_dist):
Sixth order distortion not estimated (est_dist(5)=0) - (DEFAULT) .
Main calibration optimization procedure - Number of images: 16
Gradient descent iterations: 1...done
Estimation of uncertainties...done
Calibration results after optimization (with uncertainties):
Focal Length: fc = [ 2052.60623 2089.38327 ] +/- [ 37.57733 36.76484 ]
Principal point: cc = [ 305.88023 414.00328 ] +/- [ 0.00000 0.00000 ]
Skew: alpha_c = [ 0.00000 ] +/- [ 0.00000 ] => angle of pixel axes = 90.00000 +/- 0.00000 degrees
Distortion: kc = [ 0.34437 -1.00859 0.03649 0.03054 0.00000 ] +/- [ 0.12791 1.35067 0.00791 0.00335 0.00000 ]
Pixel error: err = [ 0.97702 0.91086 ]
Note: The numerical errors are approximately three times the standard deviations (for reference).
5.其他部分
其他内容参见使用[Bouguet’s Calibration Toolbox]工具箱进行相机标定->5.显示外参、6.重新投影、7.误差分析、8.保存等。