Hi Jimmy.
You can find how the registration.dat file is used in the maskattack/lbp/script/calclbp.py file.
Reading the file:
reg_file = os.path.join(args.inputdir,'documentation','registration.dat')
f = shelve.open(reg_file)
reg = f['reg_data']
f.close()
For every x,y point on the depth image (frame), you can retrieve the metric depth:
metric_depth = reg['raw_to_mm_shift'][frame[y,x]]
For some x,y the depth map may not have a valid depth value. In this case, in the code, the average of the valid depths in 5x5 neighborhood is calculated.
Using this metric depth and the index of the x,y point (In the code, since Kinect image is 640x480, the index is calculated as index = y*640+x):
nx = (reg['registration_table'][index][0]+reg['depth_to_rgb_shift'][metric_depth])/256
ny = reg['registration_table'][index][1]
nx and ny are the color image coordinates for x,y on the depth image.
Since the registration is based on depth of the pixel, it can only be in one direction: from depth image to color image. However, the eye coordinates are manually annotated on color images.
For this reason, a search is done on the depth image for all pixels in a neighborhood of the eye coordinates (searching whole image is unnecessary since the shift is limited) until the correct
nx and ny values are found that match the annotated eye coordinates.
Nesli