校准最佳实践
准确校准对于大多数机器和计算机视觉任务的性能至关重要。以下列出了我们通过大量实验和理论思考发现的最佳实践。
- 选择正确尺寸的校准目标。足够大以正确约束参数。理想情况下,当在相机图像中正面平行时,它应该覆盖至少一半的总面积。
- 在最终应用的近似工作距离 (WD) 处进行校准。相机应在此距离处对焦,并且在校准期间或之后不得改变镜头焦距和光圈。
- 目标应具有较高的特征数。最好使用精细图案。但是,有时检测稳健性会受到影响。我们建议,如果照明可控且良好,则对于 3MPx 以上的相机使用精细图案数。
- 收集不同区域和倾斜度的图像。移动目标以完全覆盖图像区域并力求均匀覆盖。镜头失真可以从正面平行图像中正确确定,但焦距和主点估计取决于观察透视缩短。包括正面平行图像和板在水平和垂直方向上倾斜 +/- 45 度时拍摄的图像。倾斜更多通常不是一个好主意,因为特征定位精度会受到影响并且可能会出现偏差。
- 使用良好的照明。这一点经常被忽视,但却非常重要。最好通过受控的摄影照明来漫射校准目标。强点光源会导致照明不均匀,可能导致检测失败,并且不能很好地利用相机的动态范围。阴影也会产生同样的效果。
- 有足够的观测值。通常,校准应至少对校准目标的 6 个观测值(图像)进行。如果使用更高阶的相机或失真模型,则更多的观测值是有益的。
- 考虑使用 CharuCo 板等唯一编码目标。这些目标可让您从相机传感器和镜头的边缘收集观测数据,从而很好地限制失真参数。此外,即使某些特征点不满足其他要求,它们也允许您收集数据。
- 校准的准确性取决于所使用的校准目标。仅使用激光或喷墨打印的目标进行验证和测试。
- 正确安装校准目标和相机。为了最大限度地减少较大目标的扭曲和弯曲,请将其垂直安装或平放在刚性支架上。在这些情况下,请考虑移动相机而不是目标。使用优质三脚架,并避免在采集过程中触摸相机。
- 删除错误的观察结果。仔细检查重新投影错误。每个视图和每个特征都应如此。如果其中任何一个显示为异常值,请将其排除并重新校准。
- 获得较低的再现误差并不等于良好的相机校准,而仅仅表明所提供的数据/证据可以用所用的模型来描述。这可能是由于过度拟合造成的。参数不确定性表明所选相机模型的约束效果如何。
- 分析单个重投影误差。它们的方向和大小不应与位置相关,即它们应该混乱地指向所有方向。Calib.io 的相机校准器软件提供了强大的可视化功能来调查重投影误差。
遵循这些做法应能确保尽可能最准确和精确的校准。
有任何问题、评论或其他见解?请在下面发表。
@Ernest: This depends on the detection and sub pixel algorithms you are using and also on the contrast and image noise present. It usually needs testing. We would generally not recommend having squares smaller than 20×20px in the image. If detections look ok, bad numbers you are seeing are probably caused by other issues/bugs.
Hi, Your site is all very helpful. I am using your square based calibration target. Is there a minimum recommended resolution for each square in the image? For example, at my working distance, each square in the target is about 20×20 pixels on the ‘full frontal’ 640×512 image, but of course as I tilt the board for other views the squares appear smaller. OpenCV routine is returning bad numbers for focal length causing ‘undistorted()’ image to appear as if they were taken by a fisheye lens when in fact I am using 12mm lens with low distortion. Should I be using a target with larger (but fewer) squares? Thanks!
@Toby: the offset could very well be due to diffraction in the glass. With the glass exactly perpendicular to the optical axis, you would (ideally) expect no shift of the principal point but a slight change of focal length.
Thank you for the excelent recommendations for calibration.
I have calibrated a camera with and without a cover glass and found the center offset to be 129 pixels with the cover glass! (3096×2080 camera) could this indicate an incorrect camera calibration or could this be due to the cover glass?
@Eugene, the short answer would be no, you do not need to cover different distances. In fact, it is usually advisable to have the calibration target at the exact focus distance (albeit tilted to observe foreshortening), or at least at the hyperfocal distance. Moving further away would constraint a smaller image area which would not help.
Non-central general camera models would be the exception, but these are usually not called for. If you suspect the camera to exhibit distance-dependent projection, moving to different distance could help average the parameters in a standard model such that they work well under all conditions which your application calls for.