How to follow only the black line of an image
4 次查看(过去 30 天)
显示 更早的评论
I want to follow the black line on this image and get the x,y coordinates of it. However if the black line is not completing an edge of an image (as an extra line extruded as shown) I want to neglect those pixels. I want it to work similar to the concept of line following robot where it checks the next two pixel around it in each direction and maybe decide which pixel's [x,y] values it needs to consider
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171437/image.png)
0 个评论
采纳的回答
KSSV
2018-3-22
I = imread('1.png') ;
I1 = rgb2gray(I) ;
[y,x] = find(I1==0) ;
(x,y) are the locations of the black line. Now you have the points in hand. You can do what you want.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!