Skip to content

Commit

Permalink
remove transpose (#588)
Browse files Browse the repository at this point in the history
  • Loading branch information
dek3rr authored and rbiasini committed Apr 6, 2019
1 parent 4662cfc commit bdf6585
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/transformations/camera.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def normalize(img_pts, intrinsics=eon_intrinsics):
input_shape = img_pts.shape input_shape = img_pts.shape
img_pts = np.atleast_2d(img_pts) img_pts = np.atleast_2d(img_pts)
img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0],1)))) img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0],1))))
img_pts_normalized = intrinsics_inv.dot(img_pts.T).T img_pts_normalized = img_pts.dot(intrinsics_inv.T)
img_pts_normalized[(img_pts < 0).any(axis=1)] = np.nan img_pts_normalized[(img_pts < 0).any(axis=1)] = np.nan
return img_pts_normalized[:,:2].reshape(input_shape) return img_pts_normalized[:,:2].reshape(input_shape)


Expand All @@ -76,7 +76,7 @@ def denormalize(img_pts, intrinsics=eon_intrinsics):
input_shape = img_pts.shape input_shape = img_pts.shape
img_pts = np.atleast_2d(img_pts) img_pts = np.atleast_2d(img_pts)
img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0],1)))) img_pts = np.hstack((img_pts, np.ones((img_pts.shape[0],1))))
img_pts_denormalized = intrinsics.dot(img_pts.T).T img_pts_denormalized = img_pts.dot(intrinsics.T)
img_pts_denormalized[img_pts_denormalized[:,0] > W] = np.nan img_pts_denormalized[img_pts_denormalized[:,0] > W] = np.nan
img_pts_denormalized[img_pts_denormalized[:,0] < 0] = np.nan img_pts_denormalized[img_pts_denormalized[:,0] < 0] = np.nan
img_pts_denormalized[img_pts_denormalized[:,1] > H] = np.nan img_pts_denormalized[img_pts_denormalized[:,1] > H] = np.nan
Expand Down

0 comments on commit bdf6585

Please sign in to comment.