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!