Line fit between two curves.
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
Matt J
2013-8-19
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.
回答(2 个)
Image Analyst
2013-8-15
There may be simpler ways, but it looks like SVM (Support Vector Machine) would work. http://en.wikipedia.org/wiki/Support_vector_machine
10 个评论
Image Analyst
2013-8-16
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
2013-8-15
编辑:Matt J
2013-8-15
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 个评论
Matt J
2013-8-22
You can set the value of your objective function to Inf for position parameters that put the stick outside the pipe.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!