bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / measure / fit / LineModelND
class
skimage.measure.fit:LineModelND
source: /dev/scikit-image/src/skimage/measure/fit.py :168
Signature
class LineModelND ( origin , direction ) Members
-
_args_init -
_check_init_values -
_estimate -
_params2init_values -
estimate -
from_estimate -
predict -
predict_x -
predict_y -
residuals
Summary
Total least squares estimator for N-dimensional lines.
Extended Summary
In contrast to ordinary least squares line estimation, this estimator minimizes the orthogonal distances of points to the estimated line.
Lines are defined by a point (origin) and a unit vector (direction) according to the following vector equation
X = origin + lambda * directionParameters
origin: array-like, shape (N,)Coordinates of line origin in N dimensions.
direction: array-like, shape (N,)Vector giving line direction.
Raises
: ValueErrorIf length of
originanddirectiondiffer.
Examples
x = np.linspace(1, 2, 25) y = 1.5 * x + 3 lm = LineModelND.from_estimate(np.stack([x, y], axis=-1)) lm.origin✓
lm.direction # doctest: +FLOAT_CMP
✗res = lm.residuals(np.stack([x, y], axis=-1)) np.abs(np.round(res, 9)) np.round(lm.predict_y(x[:5]), 3) np.round(lm.predict_x(y[:5]), 3)✓
Aliases
-
skimage.measure.LineModelND