九点标定算法python
时间: 2023-08-21 14:02:31 浏览: 151
爱普生九点标定程序
九点标定算法的Python实现代码如下:
```python
import numpy as np
import cv2
# 通过九点标定获取的圆心相机坐标
STC_points_camera = np.array([
[207, 160], [311, 159], [415, 159],
[206, 256], [311, 257], [416, 258],
[205, 353], [311, 356], [416, 357],
])
# 通过九点标定获取的圆心机械臂坐标
STC_points_robot = np.array([
[54, -74], [-4, -76], [-54, -77],
[52, -32], [-4, -34], [-55, -35],
[50, 11], [-4, 10], [-54, 8],
])
# 手眼标定方法
class HandInEyeCalibration:
def get_m(self, points_camera, points_robot):
""" 取得相机坐标转换到机器坐标的仿射矩阵
:param points_camera: 相机坐标点集
:param points_robot: 机器坐标点集
:return: 仿射矩阵
"""
# 确保两个点集的数量级不要差距过大,否则会输出None
m, _ = cv2.estimateAffine2D(points_camera, points_robot)
return m
def get_points_robot(self, x_camera, y_camera):
""" 相机坐标通过仿射矩阵变换取得机器坐标
:param x_camera: 相机x坐标
:param y_camera: 相机y坐标
:return: 机器坐标
"""
m = self.get_m(STC_points_camera, STC_points_robot)
robot_x = (m * x_camera) + (m * y_camera) + m * x_camera) + (m * y_camera) + m<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [手眼标定算法Tsai-Lenz代码实现(Python、C++、Matlab)](https://blog.csdn.net/qq_27865227/article/details/114266140)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [Python-opencv 手眼标定(九点定位)](https://blog.csdn.net/fhjsdk/article/details/126037625)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文