Line fit between two curves.
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hey Guys,
I am trying to solve a problem regarding clearances and line fitting, around and through 2 curves.
The information I have is a coordinates of 2 parallel lines, resembling a pipe. Both these lines are not completely straight and bend at certain points.
The two line can be represented as so;
x1=[0 2 4.5 7 9];
y1=[0.7 2 4 5.5 7.5];
y2=y1+1;
plot(x1,y1,'-r')
hold on
plot(x1,y2,'-r')
grid on
I want the program to check whether a straight line of length 10 units will fit within these two line with out touching the edges. And if so how will this line sit within the two parallel lines.
The final image should look similar to this;
(add to end of previous code)
xb=[0.5 8.5];
yb=[1.5 7.5];
plot(xb,yb,'-b')
Please advice as to which commands, if any would be useful. Or what mathematical approach I should take to try and solve this.
Thanks,
6 comentarios
Matt J
el 19 de Ag. de 2013
Do you have the Optimization Toolbox? And will the pipe boundaries always be definable using a function y=f(x)? If the pipe were circular, for example, there would not be an f(x) defining its boundaries.
Respuestas (2)
Image Analyst
el 15 de Ag. de 2013
There may be simpler ways, but it looks like SVM (Support Vector Machine) would work. http://en.wikipedia.org/wiki/Support_vector_machine
10 comentarios
Image Analyst
el 16 de Ag. de 2013
I thought it was the same length. If it's not, you'd have to check for every x value just going up to the length of the stick. Like for x elements 1-10, 2-11, 3-12, and so on until you get within 10 of the end. Should be pretty fast though since we're only dealing with small arrays, not megabytes of data.
Matt J
el 15 de Ag. de 2013
Editada: Matt J
el 15 de Ag. de 2013
I recommend that you make a binary image of the pipe (e.g., using ROIFILL) and then use HOUGHLINES with the 'MinLength' option to find a segment of (at least) length 10.
11 comentarios
Matt J
el 22 de Ag. de 2013
You can set the value of your objective function to Inf for position parameters that put the stick outside the pipe.
Ver también
Categorías
Más información sobre Get Started with Curve Fitting Toolbox 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!