Skip to content

Commit aed0262

Browse files
committed
Adjust freenect_camera_to_world for 1280x1024 -> 640x480 conversion.
Otherwise all the values are off by a factor of 2 in the x direction and 2.1333333 in the y direction. Signed-off-by: Drew Fisher <[email protected]>
1 parent cddf18c commit aed0262

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/registration.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,10 @@ void freenect_camera_to_world(freenect_device* dev, int cx, int cy, int wz, doub
320320
double ref_pix_size = dev->registration.zero_plane_info.reference_pixel_size;
321321
double ref_distance = dev->registration.zero_plane_info.reference_distance;
322322
double factor = ref_pix_size * wz / ref_distance;
323-
*wx = (double)(cx - DEPTH_X_RES/2) * factor;
324-
*wy = (double)(cy - DEPTH_Y_RES/2) * factor;
323+
// We multiply cx and cy by these factors because they come from a 640x480 image,
324+
// but the zero plane pixel size is for a 1280x1024 image.
325+
*wx = (double)(cx - DEPTH_X_RES/2) * factor * (1280./640.);
326+
*wy = (double)(cy - DEPTH_Y_RES/2) * factor * (1024./480.);
325327
}
326328

327329
/// Allocate and fill registration tables

0 commit comments

Comments
 (0)