iris.nodes.geometry_estimation package¶
Submodules¶
iris.nodes.geometry_estimation.fusion_extrapolation module¶
- class iris.nodes.geometry_estimation.fusion_extrapolation.FusionExtrapolation(circle_extrapolation: ~iris.io.class_configs.Algorithm = <iris.nodes.geometry_estimation.linear_extrapolation.LinearExtrapolation object>, ellipse_fit: ~iris.io.class_configs.Algorithm = <iris.nodes.geometry_estimation.lsq_ellipse_fit_with_refinement.LSQEllipseFitWithRefinement object>, algorithm_switch_std_threshold: float = 3.5, callbacks: ~typing.List[~iris.callbacks.callback_interface.Callback] = [])[source]¶
Bases:
Algorithm
- Algorithm implements fusion extrapolation that consist of two concreate extrapolation algoriths.
circle extrapolation algorithm - linear extrapolation algorithm
ellipse extrapolation algorithm - least square ellipse fit with iris polygon refinement.
By default the linear extrapolation algorithm is used but if standard deviation of radiuses is greater than given threshold then least square ellipse fit algorithm is applied because eye is ver likely to be more elliptical then circular.
- class Parameters(*, circle_extrapolation: Algorithm, ellipse_fit: Algorithm, algorithm_switch_std_threshold: float)[source]¶
Bases:
Parameters
Parameters of fusion extrapolation algorithm.
- algorithm_switch_std_threshold: float¶
- run(input_polygons: GeometryPolygons, eye_center: EyeCenters) GeometryPolygons [source]¶
Perform extrapolation algorithm.
- Parameters:
input_polygons (GeometryPolygons) – Smoothed polygons.
eye_center (EyeCenters) – Computed eye centers.
- Returns:
Extrapolated polygons
- Return type:
iris.nodes.geometry_estimation.linear_extrapolation module¶
- class iris.nodes.geometry_estimation.linear_extrapolation.LinearExtrapolation(dphi: float = 0.9, callbacks: List[Callback] = [])[source]¶
Bases:
Algorithm
Implementation of geometry estimation algorithm through linear extrapolation in polar space.
Algorithm depends on np.interp therefore it’s better to perform smoothing beforehand.
- Algorith steps:
Map iris/pupil polygon vertices to polar space based on estimated iris/pupil centers.
- For iris/pupil, perform function interpolation in polar space to estimate missing circle points.
Note: interpolation in polar space is extrapolation in cartesian space.
Take 2 * np.pi / dphi points from function in polar space.
Map iris/pupil points from polar space back to cartesian space.
- class Parameters(*, dphi: ConstrainedFloatValue)[source]¶
Bases:
Parameters
Parameters of linear extrapolation algorithm.
- dphi: float¶
- run(input_polygons: GeometryPolygons, eye_center: EyeCenters) GeometryPolygons [source]¶
Estimate contours.
- Parameters:
input_polygons (GeometryPolygons) – Input contours.
eye_center (EyeCenters) – Eye’s centers.
- Returns:
Extrapolated contours.
- Return type:
iris.nodes.geometry_estimation.lsq_ellipse_fit_with_refinement module¶
- class iris.nodes.geometry_estimation.lsq_ellipse_fit_with_refinement.LSQEllipseFitWithRefinement(dphi: float = 1.0, callbacks: List[Callback] = [])[source]¶
Bases:
Algorithm
Algorithm that implements least square ellipse fit with iris polygon refinement by finding points to refine by computing euclidean distance.
- Algorithm steps:
Use OpenCV’s fitEllipse method to fit an ellipse to predicted iris and pupil polygons.
Refine predicted pupil polygons points to their original location to prevent location precision loss for those points which were predicted by semseg algorithm.
- class Parameters(*, dphi: ConstrainedFloatValue)[source]¶
Bases:
Parameters
Parameters of least square ellipse fit extrapolation algorithm.
- dphi: float¶
- static parametric_ellipsis(a: float, b: float, x0: float, y0: float, theta: float, nb_step: int = 100) ndarray [source]¶
Given the parameters of a general ellipsis, returns an array of points in this ellipsis.
- Parameters:
a (float) – Major axis length.
b (float) – Minor axis length.
x0 (float) – x offset.
y0 (float) – y offset.
theta (float) – rotation of the ellipsis.
nb_step (int) – number of points in the ellipsis.
- Returns:
points within the ellipsis.
- Return type:
np.ndarray
- run(input_polygons: GeometryPolygons) GeometryPolygons [source]¶
Estimate extrapolated polygons with OpenCV’s method fitEllipse.
- Parameters:
input_polygons (GeometryPolygons) – Smoothed polygons.
- Returns:
Extrapolated polygons.
- Return type: