extending the line/curve in image and get the coordinate
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
prashant singh
el 12 de Oct. de 2017
Respondida: Image Analyst
el 12 de Oct. de 2017
I have an image and I have fitted curve/line through a set of points.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168158/image.jpeg)
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168160/image.jpeg)
0 comentarios
Respuesta aceptada
Image Analyst
el 12 de Oct. de 2017
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Deep Learning for Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!