www.gusucode.com > map 案例源码 matlab代码程序 > map/WriteImageFromJPEGFileToGeoTIFFFileExample.m
%% Write Image from JPEG File to GeoTIFF File % %% % Read JPEG image from file. % Copyright 2015 The MathWorks, Inc. basename = 'boston_ovr'; imagefile = [basename '.jpg']; RGB = imread(imagefile); %% % Derive world file name from image file name, read the world file, and % construct a spatial referencing object. worldfile = getworldfilename(imagefile); R = worldfileread(worldfile, 'geographic', size(RGB)); %% % Write image data and referencing data to GeoTIFF file. filename = [basename '.tif']; geotiffwrite(filename, RGB, R) %% % Construct an empty map axes and display the map. figure usamap(RGB, R) geoshow(filename)