使用 pcolor 在 matlab 中绘制 geotiff

Plotting geotiff in matlab with pcolor

我想用这样的方案来绘制卫星图像。我正在征求有关数据类型和缩放的想法。

`ffn' 是一个 .tiff,一个适当的 geoTiff 机智良好的元数据,看起来像:

         Filename: '.17-04-04_Sentinel-2A_L1C_True_color.tiff'
      FileModDate: '13-Aug-2019 20:10:04'
         FileSize: 31465344
           Format: 'tif'
    FormatVersion: []
           Height: 2144
            Width: 4892
         BitDepth: 32
        ColorType: 'truecolor'
        ModelType: 'ModelTypeGeographic'
              PCS: ''
       Projection: ''
           MapSys: ''
             Zone: []
     CTProjection: ''
         ProjParm: []
       ProjParmId: ''
              GCS: 'WGS 84'
            Datum: 'World Geodetic System 1984'
        Ellipsoid: 'WGS 84'
        SemiMajor: 6378137
        SemiMinor: 6.3568e+06
               PM: 'Greenwich'
PMLongToGreenwich: 0
        UOMLength: ''
UOMLengthInMeters: []
         UOMAngle: 'degree'
UOMAngleInDegrees: 1
        TiePoints: [1×1 struct]
       PixelScale: [3×1 double]
       SpatialRef: [1×1 map.rasterref.GeographicCellsReference]
        RefMatrix: [3×2 double]
      BoundingBox: [2×2 double]
     CornerCoords: [1×1 struct]
     GeoTIFFCodes: [1×1 struct]
      GeoTIFFTags: [1×1 struct]

intensity_range = 2^16;

% call geoimread
[A, x, y, I] = geoimread(ffn, LON, LAT, 0);

% I.BitDepth shows that image is 32-bit, single type
% The range of A is: 0.0470 - 1

% index image
[X, map] = rgb2ind(A, intensity_range);

% get the size of the colormap
% size(map) yields 4923, 3

figure;
pcolor(x, y, X);

我看到的都是黑色。

我怀疑在转换为索引图像之前必须对 A 进行缩放。

显示的结果是黑色的,因为黑色网格隐藏了图像。

放大后可以看到图像数据。

您可以通过以下方式隐藏围栏:

h = pcolor(x, y, X);
s = findobj(h, 'type', 'surface');
s.EdgeColor = 'none';

您也可以只显示图像的一小部分,或放大(例如 zoom(100))。

您也可以尝试调整图片大小:

pcolor(imresize(x, [100, 100]), imresize(y, [100, 100]), imresize(X, [100, 100]));