2 Star 13 Fork 8

zhanghao/surround-view-system-introduction

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
run_get_weight_matrices.py 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
zemora 提交于 2020-07-15 11:57 . add all code
import os
import numpy as np
import cv2
from PIL import Image
from surround_view import FisheyeCameraModel, display_image, BirdView
import surround_view.param_settings as settings
def main():
names = settings.camera_names
images = [os.path.join(os.getcwd(), "images", name + ".png") for name in names]
yamls = [os.path.join(os.getcwd(), "yaml", name + ".yaml") for name in names]
camera_models = [FisheyeCameraModel(camera_file, camera_name) for camera_file, camera_name in zip (yamls, names)]
projected = []
for image_file, camera in zip(images, camera_models):
img = cv2.imread(image_file)
img = camera.undistort(img)
img = camera.project(img)
img = camera.flip(img)
projected.append(img)
birdview = BirdView()
Gmat, Mmat = birdview.get_weights_and_masks(projected)
birdview.update_frames(projected)
birdview.make_luminance_balance().stitch_all_parts()
birdview.make_white_balance()
birdview.copy_car_image()
ret = display_image("BirdView Result", birdview.image)
if ret > 0:
Image.fromarray((Gmat * 255).astype(np.uint8)).save("weights.png")
Image.fromarray(Mmat.astype(np.uint8)).save("masks.png")
if __name__ == "__main__":
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/zhanghao132/surround-view-system-introduction.git
git@gitee.com:zhanghao132/surround-view-system-introduction.git
zhanghao132
surround-view-system-introduction
surround-view-system-introduction
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385