MATLAB File Help: cv.fitLine Index
cv.fitLine

Fits a line to a 2D or 3D point set

lin = cv.fitLine(points)
lin = cv.fitLine(points, 'OptionName',optionValue, ...)

Input

Output

Options

The function fitLine fits a line to a 2D or 3D point set by minimizing \sum_i rho(r_i) where r_i is a distance between the i-th point and the line, and rho(r) is a distance function, one of the following:

The algorithm is based on the M-estimator (http://en.wikipedia.org/wiki/M-estimator) technique that iteratively fits the line using the weighted least-squares algorithm. After each iteration the weights w_i are adjusted to be inversely proportional to rho(r_i).