|
|
|
@ -133,10 +133,12 @@ def denormalize(img_pts, intrinsics=fcam_intrinsics, width=np.inf, height=np.inf |
|
|
|
|
img_pts = np.atleast_2d(img_pts) |
|
|
|
|
img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0], 1), dtype=img_pts.dtype))) |
|
|
|
|
img_pts_denormalized = img_pts.dot(intrinsics.T) |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 0] > width] = np.nan |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 0] < 0] = np.nan |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 1] > height] = np.nan |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 1] < 0] = np.nan |
|
|
|
|
if np.isfinite(width): |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 0] > width] = np.nan |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 0] < 0] = np.nan |
|
|
|
|
if np.isfinite(height): |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 1] > height] = np.nan |
|
|
|
|
img_pts_denormalized[img_pts_denormalized[:, 1] < 0] = np.nan |
|
|
|
|
return img_pts_denormalized[:, :2].reshape(input_shape) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|