This commit is contained in:
2025-10-31 09:55:58 +08:00
parent a7784a1486
commit 1f841c373f
8 changed files with 64 additions and 68 deletions

View File

@@ -1,7 +1,6 @@
import os
import cv2
# 摄像头名称列表
camera_names = ["front", "back", "left", "right"]
@@ -22,8 +21,8 @@ car_w = 300
car_h = 550
# 车辆与标定布指定四角之间的间隙
inn_shift_w = (cal_w - 2 * conner_w - car_w)//2
inn_shift_h = (cal_h - 2 * conner_h - car_h)//2
inn_shift_w = (cal_w - 2 * conner_w - car_w) // 2
inn_shift_h = (cal_h - 2 * conner_h - car_h) // 2
# 图片的总宽度和总高度
total_w = cal_w + 2 * shift_w
@@ -39,34 +38,34 @@ yb = total_h - yt
# 各摄像头投影区域的尺寸
project_shapes = {
"front": (total_w, yt), # 前摄像头:(宽度, 高度)
"back": (total_w, yt), # 后摄像头:(宽度, 高度)
"left": (total_h, xl), # 左摄像头:(宽度, 高度)
"right": (total_h, xl) # 右摄像头:(宽度, 高度)
"front": (total_w, yt), # 前摄像头:(宽度, 高度)
"back": (total_w, yt), # 后摄像头:(宽度, 高度)
"left": (total_h, xl), # 左摄像头:(宽度, 高度)
"right": (total_h, xl) # 右摄像头:(宽度, 高度)
}
# 待选择的四个点的像素位置
# 运行 get_projection_map.py 脚本时,必须按相同顺序点击这些像素
project_keypoints = {
"front": [(shift_w + 200, shift_h), # 前摄像头的四个关键点坐标
"front": [(shift_w + 200, shift_h),
(shift_w + 2800, shift_h),
(shift_w + 200, shift_h + 800),
(shift_w + 2800, shift_h + 800)],
"back": [(shift_w + 80, shift_h), # 后摄像头的四个关键点坐标
(shift_w + 320, shift_h),
(shift_w + 80, shift_h + 200),
(shift_w + 320, shift_h + 200)],
"back": [(shift_w + 200, shift_h),
(shift_w + 2800, shift_h),
(shift_w + 200, shift_h + 500),
(shift_w + 2800, shift_h + 500)],
"left": [(shift_w + 80, shift_h), # 左摄像头的四个关键点坐标
(shift_w + 320, shift_h),
(shift_w + 80, shift_h + 200),
(shift_w + 320, shift_h + 200)],
"right": [(shift_h + 240, shift_w), # 右摄像头的四个关键点坐标
(shift_h + 560, shift_w),
(shift_h + 240, shift_w + 120),
(shift_h + 560, shift_w + 120)],
"left": [(shift_w + 300, shift_h),
(shift_w + 3200, shift_h),
(shift_w + 300, shift_h + 700),
(shift_w + 3200, shift_h + 700)],
"right": [(shift_h + 500, shift_w),
(shift_h + 3300, shift_w),
(shift_h + 500, shift_w + 600),
(shift_h + 3300, shift_w + 600)],
}
# 读取车辆图片并调整尺寸以匹配车辆所在区域