【发布时间】:2017-09-06 16:36:32
【问题描述】:
我正在尝试从附加的 png 在 Matlab 中创建一个 geoTIFF 文件。 example image 我正在遵循以下提供的示例: https://uk.mathworks.com/help/map/examples/exporting-images-and-raster-grids-to-geotiff.html
但需要从头开始创建地理配准信息,因此使用 makerefmat 和 worldfilewrite 来实现这一点。下面的代码不会导致崩溃,但会生成一个图像阅读器似乎很难处理的 TIFF,所以我认为我做错了什么。由于我以前没有使用过 TIFF 标签,因此也可能存在一些冗余。任何帮助表示赞赏!
% Load image without georeferencing
RGB = imread('uk_dT.png');
% Create worldfile for image. At present this is done by first creating a
% reference matrix, then using these values to generate a worldfile.
% Longitude spans -17:10 (west to east), latitude 63:47 (north to south)
lonmin = -17; lonmax = 10; latmin = 47; latmax = 63;
DX = (lonmax-lonmin)/(length(RGB(1,:,1))); DY = (latmin-latmax)/(length(RGB(:,1,1)));
R = makerefmat(lonmin, latmax, DX, DY);
worldfilewrite(R,'uk_dT.tfw');
% Read worldfile, create geotiff
REF = worldfileread('uk_dT.tfw','geographic',size(RGB));
geotiffwrite('uk_dT.tif',RGB,REF)
【问题讨论】: