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 CenterFile Exchange에서 Mapping Toolbox에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by