interpolate_screen_pos
[source]
interpolate_screen_pos
(screen_pos
,xnew
,ynew
,kind
='linear'
)
Interpolate the position of the xnew and ynew pixels from the original screen_pos.
interpolate_checker_pos
should be used instead as it's more user friendly.
params:
- screen_pos: Screen positions in shape (17, 10, 2) obtained from calibration (from 80x80 pixel checker corners on a 1280x720px screen)
- xnew: New pixels indexes in x, in interval [0, 17[
- ynew: New pixels indexes in y, in interval [0, 10[
return:
- Screen positions in shape (len(xnew),len(ynew), 2)
interpolate_checker_pos
[source]
interpolate_checker_pos
(screen_pos
,width_box
,height_box
,kind
='linear'
)
Interpolate the centre of the checkerboard pixels from the screen calibrated position. params:
- screen_pos: Screen positions in shape (17, 10, 2) obtained from calibration (from 80x80 pixel checker corners on a 1280x720px screen)
- width_box: Width in pixel of a box
- height_box: Height in pixel of a box
- kind: kind of interpolation in {'linear', 'cubic', 'quintic'}
split_eye_events
[source]
split_eye_events
(eye_tracking
,eps
=2
)
Split the record where the eye moves. Detection done with clustering on X,Y and time of the eye position.
params:
- eye_tracking: Eye traking array of the ellipse fit, in shape (t, (x,y,width,height,angle))
- eps: Distance to detect eye movements. Adjust this parameter if results are not satisfying
- kind: kind of interpolation in {'linear', 'cubic', 'quintic'}
return:
- move_indexes, blink_indexes, noise_indexes
get_spherical_map
[source]
get_spherical_map
(screen_pos
,input_res
=(281, 500)
,output_res
=(360, 640)
,k_side
=2
,filling_pol
='nonzero'
)
Generate the mapping from normal image to an image projected on a spherical screen params:
- screen_pos: Screen positions in shape (17, 10, (elev, azim)) obtained from calibration (from 80x80 pixel checker corners on a 1280x720px screen)
- input_res: resolution of the input image
- output_res: resolution of the output image
- k_side: Kernel side's size to fill holes in the mapped image (2 -> 5*5 kernel)
- filling_pol: Filling policy for the empty values, to which `f_fill` of [`apply_spherical_map`](/theonerig/eyetrack.html#apply_spherical_map) will be applied
nonzero: indexes of all nonzero elements
closest: index of the closest nonzero element
returns:
- A mapping to be used in [`apply_spherical_map`](/theonerig/eyetrack.html#apply_spherical_map)
apply_spherical_map
[source]
apply_spherical_map
(img_src
,mapping
,output_res
=(360, 640)
,f_fill
=mean
)
Apply a mapping to an input image params:
- img_src: Source image to transform
- mapping: Mapping obtained from [`get_spherical_map`](/theonerig/eyetrack.html#get_spherical_map)
- output_res: Output resolution. Must match the parameter given to [`get_spherical_map`](/theonerig/eyetrack.html#get_spherical_map)
- f_fill: Function to apply when filling the holes (e.g. np.median, np.mean)
return:
- The transformed image