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!