总述
康耐视中与双目3D定位相关的共涉及4个API,分别是相机标定、手眼标定、计算3D坐标、估计位姿偏移。
函数功能 | 主体类型 | 返回值类型 |
---|---|---|
相机标定 | Cog3DCameraCalibrator | Cog3DCameraCalibrationResult |
手眼标定 | Cog3DHandEyeCalibrator | List <Cog3DHandEyeCalibrationResult> |
三角测量获得3D点坐标 | Cog3DTriangulator | Cog3DVect3Collection |
通过2D点估计3D姿态 | List <Cog3DPoseEstimatorUsing2DPoints> |
Cog3DPoseEstimatorUsing2DPointsResult |
相机标定(Cognex)
相机标定执行
康耐视的相机标定函数有6种重载:
一般用的是:
1 | public Cog3DCameraCalibrationResult Execute( |
参数 | 描述 | 备注 |
---|---|---|
pelRectRaw2Ds | 原始获取图像的ROI | 一般即图像大小 |
crspFeatures | 相机拍摄标定板的特征对 crspFeatures[i][j]对应第i个标定板姿态的第j个相机 |
包含PointsModel3D、PointsRaw2D、Weights |
zHeightsPhys3D | 不同标定板姿态下的z位置 与下一个参数poseTypes对应,需长度相同 |
|
poseTypes | 标定板姿态类型 |
标定板姿态
康耐视支持5种标定板姿态:
Cog3DCalibrationPlatePoseTypeConstants
成员名 | 描述 | 备注 |
---|---|---|
PoseDefineWorldCoord | 定义世界坐标系系统 | |
PoseElevated | 与定义世界坐标系的姿态精确平行(需指定两个标定板姿态之间的偏移) 注意:平面中的(x,y)平移和旋转是不受约束的 |
|
PoseTilted | 任意位置 | |
PoseSpecified | 准确定位在世界坐标系下的已知姿态 | |
DefaultPoseType | 等价于PoseDefineWorldCoord |
相机内参
1 | public Cog3DCameraCalibrationIntrinsics( |
相机内参由5部分构成:
成员名 | 描述 | 备注 |
---|---|---|
scale | x、y的比例 | 2个数 |
skew | 偏度系数 | 1个数 |
translation | x、y的平移 | 2个数 |
distortionModel | 畸变模型 | 默认是e3ParamRadial |
kc | 透镜畸变的系数 | 一般为3个数(e3ParamRadial)、6个数(eSineTanLawProjection)、0个数(eNoDistortion、eTelecentric) |
畸变模型
康耐视支持4种畸变模型(distortion model):
Cog3DCameraCalibrationDistortionModelConstants
成员名 | 描述 | 备注 |
---|---|---|
eSineTanLawProjection | “high distortion” lenses – short focal length lenses which exhibit apparent distortion | 高度畸变的镜头——短焦距镜头,表现出明显的畸变 |
eNoDistortion | ideal lenses without distortion | 理想的无畸变的镜头 |
e3ParamRadial | “low distortion” lenses – where the distortion is not apparent to the human eye – but where distortion correction can improve accuracy performance nonetheless | 默认,低畸变的镜头——畸变对人眼不明显,但畸变校正可以提高精度 |
eTelecentric | telecentric lenses | 远心镜头 |
相机标定(Cognex VS OpenCV)
相机标定得到的内参仅仅是对相机物理特性的【近似】
VisionPro
坐标系 | 描述 | 原点 | 单位 | 左/右手 |
---|---|---|---|---|
Raw2D | 相机获取的原始2D图像空间 | 左上角 | 像素 | 左手系 |
Camera2D | 去除光学畸变、像素高宽比的影响后的无畸变2D空间 | 中心 | 物理 | 右手系 |
基于VisionPro的c#代码:
1 | using Cognex.VisionPro3D; |
基于OpenCV的python代码:
1 | import numpy as np |
标定验证
Cog3DCameraCalibrationValidator
参考
参考内容 | 参考方面 |
---|---|
Cognex VisionPro 9.1的例程:samples3d\Programming\Setup\Calibration | 主体思路 |
知乎:机器视觉的相机标定到底是什么? | 相机标定总述 |