フィルターのクリア

extending the line/curve in image and get the coordinate

3 ビュー (過去 30 日間)
prashant singh
prashant singh 2017 年 10 月 12 日
回答済み: Image Analyst 2017 年 10 月 12 日
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

採用された回答

Image Analyst
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 件)

カテゴリ

Help Center および File ExchangeDeep Learning for Image Processing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by