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

2 Ansichten (letzte 30 Tage)
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;

Antworten (2)

Image Analyst
Image Analyst am 4 Jan. 2022
Use the Color Thresholder tool on the Apps tab of the tool ribbon.
See attached demo.

Image Analyst
Image Analyst am 5 Jan. 2022
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.

Kategorien

Mehr zu Mapping Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by