ruijiege

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

因为是pixel映射到对应的M矩阵对应位置,并且只需要前4个值(left,right,top,bottom)

merge_mosaic_pixel_annotations = np.arange(0, 10).reshape(2, 5)
print(f"merge_mosaic_pixel_annotations {merge_mosaic_pixel_annotations}")
M = np.array([
    [1, 0, 3],
    [0, 1, 3]
], dtype=np.float32)
num_targets = len(merge_mosaic_pixel_annotations)
targets_temp = np.ones((num_targets * 2, 3))
targets_temp[:, :2] = merge_mosaic_pixel_annotations[:, :4].reshape(num_targets * 2, 2)

merge_projection_pixel_annotations = merge_mosaic_pixel_annotations.copy()
merge_projection_pixel_annotations[:, :4] = (targets_temp @ M.T).reshape(num_targets, 4)
print(f"merge_projection_pixel_annotations {merge_projection_pixel_annotations}")
View Code

 

posted on 2022-11-15 15:55  哦哟这个怎么搞  阅读(38)  评论(0编辑  收藏  举报