159 lines
4.5 KiB
Markdown
159 lines
4.5 KiB
Markdown
# 拍照流程
|
||
1 执行 capture.py
|
||
2 执行完成后 \ssh_tmp 目录下会生成 outpu.png 和 output.ply
|
||
3 执行 calibration_mian.py
|
||
4 查看执行的消息
|
||
|
||
|
||
# 问题
|
||
def detect_marks_roi(im_project, show=False):
|
||
masks = []
|
||
# ???
|
||
offset = 40
|
||
|
||
|
||
|
||
|
||
# camera_driver
|
||
相机驱动代码
|
||
## 编译
|
||
拷贝到虚拟机编译环境
|
||
cmake ..
|
||
make -j8
|
||
## 执行
|
||
将可执行文件 camera_driver 拷贝到目标机器
|
||
/root/calibration
|
||
chmod 777 ./camera_driver
|
||
./camera_driver
|
||
执行完成后在当前目录下生成 output.png 文件
|
||
|
||
# lidar_driver
|
||
雷达驱动代码
|
||
## 编译
|
||
拷贝到虚拟机编译环境
|
||
cmake ..
|
||
make -j8
|
||
## 执行
|
||
将可执行文件 lidar_driver 拷贝到目标机器
|
||
/root/calibration
|
||
chmod 777 ./lidar_driver
|
||
./lidar_driver
|
||
执行完成后在当前目录下生成 output.ply 文件
|
||
|
||
# sh 脚本
|
||
## 安装
|
||
安装前需关闭代理
|
||
pip install paramiko scp -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||
|
||
capture.py
|
||
def cameraCap():
|
||
def lidarCap():
|
||
|
||
# samples
|
||
数据目录
|
||
|
||
# error record
|
||
## 1
|
||
ypr
|
||
==>
|
||
rpy
|
||
## 2
|
||
if point_3d[0] > 0: point_3d[0] = point_3d[0] + point_3d[0] / _r * kk
|
||
else: point_3d[0] = point_3d[0] - point_3d[0] / _r * kk
|
||
==>
|
||
if point_3d[0] > 0: point_3d[0] = point_3d[0] + point_3d[0] / _r * kk
|
||
else: point_3d[0] = point_3d[0] + point_3d[0] / _r * kk
|
||
## 3
|
||
if cv2.pointPolygonTest(np.asarray(mark_rois[i]), (x,y), False) > 0:
|
||
==>
|
||
if cv2.pointPolygonTest(np.asarray(mark_rois[i]), (x,y), False) >= 0:
|
||
|
||
|
||
# 执行条件
|
||
## num 4
|
||
### z < 3.5 该值设置过大,会增加误差
|
||
conf_max_exclude_num = 4
|
||
svd.scipy_svd
|
||
samples_size = 15
|
||
times_per_one_sample = 5
|
||
box3
|
||
kk = 0.0
|
||
### distance_threshold=0.01 ransac_n=100
|
||
def correct_mark_cloud(mark_pcd):
|
||
plane_model, inliers = mark_pcd.segment_plane(distance_threshold=0.01,
|
||
ransac_n=100,
|
||
num_iterations=1500)
|
||
inlier_cloud = mark_pcd.select_by_index(inliers)
|
||
inlier_cloud = inlier_cloud.paint_uniform_color([1.0, 0, 0])
|
||
outlier_cloud = mark_pcd.select_by_index(inliers, invert=True)
|
||
cv2.findHomography(np.array(pts_3d), np.array(pts_hom), cv2.RANSAC, ransacReprojThreshold)
|
||
ransacReprojThreshold = 0.5
|
||
|
||
## num 5
|
||
### z < 3.5 该值设置过大,会增加误差
|
||
conf_max_exclude_num = 4
|
||
svd.scipy_svd
|
||
samples_size = 10
|
||
times_per_one_sample = 4
|
||
box3
|
||
kk = 0.0
|
||
def correct_mark_cloud(mark_pcd):
|
||
### distance_threshold=0.015 ransac_n=2000
|
||
plane_model, inliers = mark_pcd.segment_plane(distance_threshold=0.015,
|
||
ransac_n=2000,
|
||
num_iterations=1500)
|
||
inlier_cloud = mark_pcd.select_by_index(inliers)
|
||
inlier_cloud = inlier_cloud.paint_uniform_color([1.0, 0, 0])
|
||
outlier_cloud = mark_pcd.select_by_index(inliers, invert=True)
|
||
|
||
|
||
## num 6
|
||
### z < 3.5 该值设置过大,会增加误差
|
||
conf_max_exclude_num = 4
|
||
svd.scipy_svd
|
||
### samples_size = 10
|
||
### times_per_one_sample = 4
|
||
box3
|
||
kk = 0.0
|
||
def correct_mark_cloud(mark_pcd):
|
||
### distance_threshold=0.01 ransac_n=2000
|
||
plane_model, inliers = mark_pcd.segment_plane(distance_threshold=0.015,
|
||
ransac_n=2000,
|
||
num_iterations=1500)
|
||
|
||
## num 7
|
||
### z < 3.5 该值设置过大,会增加误差
|
||
conf_max_exclude_num = 4
|
||
svd.scipy_svd
|
||
### samples_size = 10
|
||
### times_per_one_sample = 4
|
||
box3
|
||
kk = 0.0
|
||
def correct_mark_cloud(mark_pcd):
|
||
### distance_threshold=0.015 ransac_n=100
|
||
plane_model, inliers = mark_pcd.segment_plane(distance_threshold=0.015,
|
||
ransac_n=2000,
|
||
num_iterations=1500)
|
||
|
||
## num 8
|
||
ransacReprojThreshold = 3.0
|
||
|
||
## point.json
|
||
|
||
|
||
main
|
||
calibration_by_all_samples_points
|
||
遍历子文件夹
|
||
遍历循环次数
|
||
step1_get_aruco_and_lidar_marks_and_conners(重写)
|
||
aurco3d.cal_camera_marks_3d_conners
|
||
cloud3d.cal_marks_3d_conners_simple
|
||
return aurco_marks_conners, pcd_marks_conners_new
|
||
step2_exclude_bad_conners
|
||
去除坏点
|
||
step3_cal_aruco_and_lidar_marks_rt
|
||
_R, _t, _ ,_ = svd.scipy_svd(array_pcd_marks_conners, array_aurco_marks_conners)
|
||
# _r, _p, _y = utils.rotation_matrix_to_euler_angles(_R)
|
||
_r, _p, _y = utils.rotation_matrix_to_rpy(_R)
|
||
calibration_result.append([subdir, str(times), __mean, _t, _rpy, _new_rpy])
|