2017. 11. 15. 13:15
fitLine
Fits a line to a 2D or 3D point set.
- C++:
fitLine
(InputArray points, OutputArray line, int distType, double param, double reps, double aeps)
- Python:
cv2.
fitLine
(points, distType, param, reps, aeps[, line]) → line
- C:
cvFitLine
(const CvArr* points, int dist_type, double param, double reps, double aeps, float* line)
- Python:
cv.
FitLine
(points, dist_type, param, reps, aeps) → line Parameters: - points – Input vector of 2D or 3D points, stored in
std::vector<>
orMat
. - line – Output line parameters. In case of 2D fitting, it should be a vector of 4 elements (like
Vec4f
) -(vx, vy,x0, y0)
, where(vx, vy)
is a normalized vector collinear to the line and(x0, y0)
is a point on the line. In case of 3D fitting, it should be a vector of 6 elements (likeVec6f
) -(vx, vy, vz, x0, y0, z0)
, where(vx, vy, vz)
is a normalized vector collinear to the line and(x0, y0, z0)
is a point on the line. - distType – Distance used by the M-estimator (see the discussion below).
- param – Numerical parameter (
C
) for some types of distances. If it is 0, an optimal value is chosen. - reps – Sufficient accuracy for the radius (distance between the coordinate origin and the line).
- aeps – Sufficient accuracy for the angle. 0.01 would be a good default value for
reps
andaeps
.
- points – Input vector of 2D or 3D points, stored in
The function fitLine
fits a line to a 2D or 3D point set by minimizing where is a distance between the point, the line and is a distance function, one of the following:
distType=CV_DIST_L2
distType=CV_DIST_L1
distType=CV_DIST_L12
distType=CV_DIST_FAIR
distType=CV_DIST_WELSCH
distType=CV_DIST_HUBER
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 are adjusted to be inversely proportional to
'OpenCV' 카테고리의 다른 글
내부 최소사각형 - minAreaRect (0) | 2017.11.15 |
---|---|
내부 최대 원 찾기 - minEnclosingCircle (0) | 2017.11.15 |
구멍 채우기 - fitEllipse (0) | 2017.11.15 |
형태 볼록함 결점찾기, 구멍찾기 - convexityDefects (0) | 2017.11.15 |
형태 넓이 구하기 - contourArea (0) | 2017.11.15 |