extending the line/curve in image and get the coordinate
조회 수: 2 (최근 30일)
이전 댓글 표시
I have an image and I have fitted curve/line through a set of points.
I want to extend the curve/line down in the image and get the coordinates through which the line passes, as show below in blue
댓글 수: 0
채택된 답변
Image Analyst
2017년 10월 12일
Fit a line with polyfit(), then extrapolate with polyval():
% Sort in order of increasing y
[sortedY, sortOrder] = sort(y);
% Sort x the same way:
sortedX = x(sortOrder);
% Fit a line through existing training points.
coefficients = polyfit(sortedY, sortedX, 1); % Note: I swapped x and y intentionally!
% Define y for what we want
fittedY = 1 : rows;
% Get fit and extrapolated values.
fittedX = polyval(coefficients, fittedY);
hold on;
plot(fittedX, fittedY, 'c-', 'LineWidth', 2);
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!