generalize camera assumptions (#2423)

* clean up 1

* complain

* cleanup

* make models api generic

* clean up 2

* cleanup

* remove unused
old-commit-hash: c0946c8bdbaac0029c67e0b2ba4e591f591790eb
This commit is contained in:
ZwX1616
2020-11-05 13:22:28 -08:00
committed by GitHub
parent fcb995e19c
commit 4dc3fb994e
5 changed files with 120 additions and 86 deletions
+5 -1
View File
@@ -6,6 +6,8 @@ import matplotlib.pyplot as plt
import numpy as np
import pygame # pylint: disable=import-error
from common.transformations.camera import (eon_f_frame_size, eon_f_focal_length,
tici_f_frame_size, tici_f_focal_length)
from selfdrive.config import RADAR_TO_CAMERA
from selfdrive.config import UIParams as UP
from selfdrive.controls.lib.lane_planner import (compute_path_pinv,
@@ -29,7 +31,9 @@ _FULL_FRAME_SIZE = {
_BB_TO_FULL_FRAME = {}
_FULL_FRAME_TO_BB = {}
_INTRINSICS = {}
for width, height, focal in [(1164, 874, 910), (1928, 1208, 2648)]:
cams = [(eon_f_frame_size[0], eon_f_frame_size[1], eon_f_focal_length),
(tici_f_frame_size[0], tici_f_frame_size[1], tici_f_focal_length)]
for width, height, focal in cams:
sz = width * height
_BB_SCALE = width / 640.
_BB_TO_FULL_FRAME[sz] = np.asarray([
+1 -1
View File
@@ -196,7 +196,7 @@ def ui_thread(addr, frame_address):
if sm.updated['liveCalibration'] and num_px:
extrinsic_matrix = np.asarray(sm['liveCalibration'].extrinsicMatrix).reshape(3, 4)
ke = intrinsic_matrix.dot(extrinsic_matrix)
warp_matrix = get_camera_frame_from_model_frame(ke)
warp_matrix = get_camera_frame_from_model_frame(ke, camera_fl=intrinsic_matrix[0][0])
calibration = CalibrationTransformsForWarpMatrix(num_px, warp_matrix, intrinsic_matrix, extrinsic_matrix)
# draw red pt for lead car in the main img