模拟车辆变道 python 可视化

目录

车头朝向一起变化

车头朝向不变化,矩形框


车头朝向一起变化

模拟车辆变道 python 可视化_第1张图片

import cv2
import numpy as np


def world_to_pixel(world_x, world_y, img_w=800, img_h=800):
    scale_x = img_w / 120  # 横向范围:0~120米
    scale_y = img_h / 80  # 纵向范围:0~80米
    pixel_x = int(world_x * scale_x)
    pixel_y = img_h - int(world_y * scale_y)  # OpenCV坐标系Y轴向下
    return (pixel_x, pixel_y)


def draw_rotated_rect(img, center, size, angle,

你可能感兴趣的:(python基础,python宝典,人工智能)