How to join two points, on a 'map', created with the command 'ginput'?
Show older comments
So, this is my code for the two dots. But I don't know how to unite them like in the picture. (don't know how to make that dotted line)Code:
harta=imread('harta.jpg');
imshow(harta)
[xA,yA]=ginput(1);
[xB,yB]=ginput(1);
harta=insertMarker(harta,[xA yA],'*','color','r');
harta=insertMarker(harta,[xB yB],'*','color','r');
imshow(harta)
Accepted Answer
More Answers (1)
Stijn Haenen
on 11 May 2020
You can use this code, which contains the function ginput_norm: https://nl.mathworks.com/matlabcentral/fileexchange/75469-ginput-with-normalized-coordinates-of-the-figure-window
close all
clear
figure1=figure(1);
axes('Parent',figure1,...
'Position',[0 0 1 1]);
set(figure1,'Units','Normalized');
mapsIm=imread('maps.jpg');
imshow(mapsIm);
a=ginput_norm(2);
annotation(figure1,'line',[a(1,1) a(2,1)],...
[a(1,2) a(2,2)],'LineStyle','--');
Categories
Find more on Semantic Segmentation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
