linemodel

LineModel

class skimage.measure.LineModel [source]

Bases: skimage.measure.fit.BaseModel

Total least squares estimator for 2D lines.

Lines are parameterized using polar coordinates as functional model:

dist = x * cos(theta) + y * sin(theta)

This parameterization is able to model vertical lines in contrast to the standard line model y = a*x + b.

This estimator minimizes the squared distances from all points to the line:

min{ sum((dist - x_i * cos(theta) + y_i * sin(theta))**2) }

A minimum number of 2 points is required to solve for the parameters.

Deprecated class. Use LineModelND instead.

Attributes

params (tuple) Line model parameters in the following order dist, theta.
__init__() [source]
estimate(data) [source]

Estimate line model from data using total least squares.

Parameters:

data : (N, 2) array

N points with (x, y) coordinates, respectively.

Returns:

success : bool

True, if model estimation succeeds.

predict_x(y, params=None) [source]

Predict x-coordinates using the estimated model.

Parameters:

y : array

y-coordinates.

params : (2, ) array, optional

Optional custom parameter set.

Returns:

x : array

Predicted x-coordinates.

predict_y(x, params=None) [source]

Predict y-coordinates using the estimated model.

Parameters:

x : array

x-coordinates.

params : (2, ) array, optional

Optional custom parameter set.

Returns:

y : array

Predicted y-coordinates.

residuals(data) [source]

Determine residuals of data to model.

For each point the shortest distance to the line is returned.

Parameters:

data : (N, 2) array

N points with (x, y) coordinates, respectively.

Returns:

residuals : (N, ) array

Residual for each data point.

doc_scikit_image
2017-01-12 17:21:48
Comments
Leave a Comment

Please login to continue.