Skip to content

Commit

Permalink
[FIX] add fy variable from proj_matrix for pixel-to-point projection
Browse files Browse the repository at this point in the history
  • Loading branch information
hollydinkel committed Feb 10, 2024
1 parent 313f4bf commit fd0ae23
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions trackdlo/src/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def callback (rgb, depth):
all_pixel_coords = np.flip(all_pixel_coords, 1)

pc_z = cur_depth[tuple(map(tuple, all_pixel_coords.T))] / 1000.0
f = proj_matrix[0, 0]
fx = proj_matrix[0, 0]
fy = proj_matrix[1, 1]
cx = proj_matrix[0, 2]
cy = proj_matrix[1, 2]
pixel_x = all_pixel_coords[:, 1]
Expand All @@ -95,8 +96,8 @@ def callback (rgb, depth):
if pixel_value1 == 255:
pixel_x, pixel_y = pixel_x[::-1], pixel_y[::-1]

pc_x = (pixel_x - cx) * pc_z / f
pc_y = (pixel_y - cy) * pc_z / f
pc_x = (pixel_x - cx) * pc_z / fx
pc_y = (pixel_y - cy) * pc_z / fy
extracted_chains_3d = np.vstack((pc_x, pc_y))
extracted_chains_3d = np.vstack((extracted_chains_3d, pc_z))
extracted_chains_3d = extracted_chains_3d.T
Expand Down

0 comments on commit fd0ae23

Please sign in to comment.