Find intersecting points in a image

조회 수: 5 (최근 30일)
mathru
mathru 2021년 2월 2일
댓글: mathru 2021년 2월 2일
How can I extract the boundary points of the first image. How can I plot it? How can I fiit a polynomical on the image boundary?
In the bottom image, after fitting a polynomial on the image boundary how an I find the intersecting points of the line and fitted polynomial ?

답변 (1개)

KSSV
KSSV 2021년 2월 2일
I = imread('myimage') ; % give your image
[y,x] = find(I==0) ; % white pixel value;
idx = boundary(x,y) ;
bnd = [x(idx) y(idx)] ; % boundary points data
Now you have boundary data points in hand. Make your line for which you want to get the intersection points with boundary. And then use https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections
Also there are other ways to get the intersection points without using the above. Read about knnsearch.
  댓글 수: 1
mathru
mathru 2021년 2월 2일
While running the code using your commands, getting the following error:
Index in position 2 exceeds array bounds (must not exceed 2).

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by