CODING MATLAB: How to use a simple MATLAB programming to plot an image from the Google Earth

Subscribe to my Youtube Channel to learn basic MATLAB Programming. Thanks a ton for your support!

  1. How to use a simple MATLAB programming to plot an image from the Google Earth. Coding is available below:

%% This is a program to geocode image from google map
% Prepared by Nurul H. Idris (2021)
% If you are using this code, kindly give acknowledgement:
% Nurul H.Idris (2021),”How to use a simple MATLAB programming to plot an image from the Google Earth”, https://www.youtube.com/watch?v=9_YsPikRczk&t=306s

A=imread(‘study_area.jpg’,’jpg’);
[a,b,c]=size(A)
figure
%specify the coordinate(lat,lon) of the
inputpoints(1,:)=[18.75,87.18];%upperleft
inputpoints(2,:)=[-5,87.18];%lowerleft
inputpoints(3,:)=[18.75,127.19];%upperright
inputpoints(4,:)=[-5,127.19];%lowerright
inputpoints=fliplr(inputpoints);

basepoints(1,:)=[1,716];%follow the size of A
basepoints(2,:)=[1,1];
basepoints(3,:)=[1030,716];
basepoints(4,:)=[1030,1];

tform=cp2tform(inputpoints,basepoints,’affine’);
[newGBR,x,y]=imtransform(A,tform);

X=inputpoints(2,1):(inputpoints(3,1)-inputpoints(2,1))/100:inputpoints(3,1);
Y=(inputpoints(1,2):(inputpoints(4,2)-inputpoints(1,2))/10:inputpoints(4,2));
imshow(newGBR,’XData’,X,’YDATA’,Y),axis on
%for northern hemisphere, in the image, click axis, and unclick reverse