因为是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}")