MATLAB: How to make image half-transparent and how do i plot on the image

imageimreadplotplotting

i want to plot
this on the image
how do i make the image of the map above half-transeparnt and plot on it??
the code of plot is
load('gps_wgs84.mat');
len = length(gps(:,1));
start_point =gps(1,:);
end_point =gps (len,:);
figure(1); zlim([0 100]); hold on; grid on; title('GPS wgs84');
xlabel('latitude'); ylabel('longitude'); zlabel('altitude');
plot3(start_point(1),start_point(2),start_point(3),'o', ...
'MarkerFaceColor','b');
plot3(end_point(1), end_point(2), end_point(3),'o', ...
'MarkerFaceColor','r');
for t=1:len
if(gps(t,4)==2)
plot3(gps(t,1),gps(t,2),gps(t,3),'.y','Markersize',5);
elseif(gps(t,4)==5)plot3(gps(t,1),gps(t,2),gps(t,3),'.g','Markersize',5);
elseif(gps(t,4)==4)
plot3(gps(t,1),gps(t,2),gps(t,3),'.m','Markersize',5);
elseif(gps(t,4)==1)
plot3(gps(t,1),gps(t,2),gps(t,3),'.k','Markersize',5);
end
end
[utmX,utmY,utmzone,utmhemi]=wgs2utm(gps(:,1),gps(:,2),52,'s');
figure(2); hold on; grid on; title('GPS UTM');;
xlabel('x (m)'); ylabel('y (m)'); plot(utmX, utmY);
plot(utmX(1,1), utmY(1,1),'o','MarkerFaceColor','b');
plot(utmX(len,1), utmY(len,1),'o','MarkerFaceColor','r');
[utmX,utmY,utmzone,utmhemi]=wgs2utm(gps(:,1),gps(:,2),52,'s');
figure(2); hold on; grid on; title('GPS UTM');;
xlabel('x (m)'); ylabel('y (m)'); plot(utmX, utmY);
plot(utmX(1,1), utmY(1,1),'o','MarkerFaceColor','b');
plot(utmX(len,1), utmY(len,1),'o','MarkerFaceColor','r');
>>

Best Answer

  • If you want to draw something on image, plot image (imshow) and plot lines which you want on the image
    for example
    imshow('moon.tif');hold on
    hold on,plot([200 300 300 200 200],[300 300 200 200 300],'LineWidth',5)
    PS: You have to scale your data according to image dimension