How can I get the blue line in google maps screenshot? And also how can I fill the blanks in line?

2 ビュー (過去 30 日間)
I need the coordinates of the blue road in google directions. But there are gaps because there are texts in between. I can't get the only blue part. I tried to do as below.
map = imread('map3.png');
subplot(3,3,1);
imshow(map, []);
[R,G,B] = imsplit(map);
subplot(3,3,2);
imshow(R, []);
Istrech = imadjust(R,stretchlim(R));
subplot(3,3,3);
imshow(Istrech, [])
filteredImage = imbothat(Istrech, true(50));
subplot(3,3,4);
imshow(filteredImage, []);
threshold = 130;
mask = imfill(filteredImage, 'holes');
subplot(3,3,5);
imshow(mask, []);
mask2 = mask > threshold;
subplot(3,3,6);
imshow(mask2, []);
mask3= bwareaopen(mask2, 9);
subplot(3,3,7);
imshow(mask3, []);
mask4 = bwareafilt(mask3, 1);
subplot(3,3,8);
imshow(mask4, []);
BW2 = bwpropfilt(mask4,'perimeter',20);
subplot(3,3,9);
imshow(BW2, []);
I also need to embed this path as a MAtlab function in simulink like shown in below. How can I do that?
function y = fcn(u)
y = u;

回答 (2 件)

Image Analyst
Image Analyst 2022 年 1 月 4 日
Use the Color Thresholder tool on the Apps tab of the tool ribbon.
See attached demo.

Image Analyst
Image Analyst 2022 年 1 月 5 日
Well you could try imclose() though that may change the shapes slightly. Or you could try searching for edge linking routines. See link and attachment, and do a web search yourself.

カテゴリ

Help Center および File ExchangeMapping Toolbox についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by