Identifying straight line & intersection with the curve from the binary image
Show older comments
I want to fit a blue line (curved or straight), detect a red line, and then find the slope of the light green line that is tangent to the blue line at the intersection of the two lines.

By detecting the first row in each column with the value 1, I could detect blue line.
Also, fitting blue curvature from this data would be no problem.
(Based on my previous question ( https://kr.mathworks.com/matlabcentral/answers/2050272-curvature-detection-from-outlines-of-the-binary-image?s_tid=srchtitle) and kind answer of "Image Analyst").
In the case of a straight line section, it seems to be possible to first find the row with a value of 1 for each column, average it, and then draw a straight line to the value on the leftmost side.
However, in this case, it seems that I have to manually determine the location of the pixel corresponding to the straight line section(otherwise, even curved surfaces will be recognized).
Any suggestion would be very helpful.
Thank you.
Accepted Answer
More Answers (1)
load BWimage
C=bwareafilt(BW&~imopen(BW,ones(1,8)),1);
[I,J]=find(C);
x=mean(J); y=max(I); %intersection coordinates
imshow(BW); hold on
scatter(x,y,'r','filled'); hold off
3 Comments
Image Analyst
on 28 Nov 2023
@DW You can click the Vote icon on his answer. Clicking Vote also awards reputation points.
DW
on 29 Nov 2023
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!