主要内容

本页采用了机器翻译。点击此处可查看英文原文。

worldfileread

读取世界文件并返回引用对象

已移除了返回引用矩阵的 worldfileread 函数的语法。请改用返回引用对象的语法。有关详细信息,请参阅版本历史记录

说明

R = worldfileread(worldFileName,coordinateSystemType,rasterSize) 从世界文件 worldFileName 中创建了一个栅格参考对象 R。参量 coordinateSystemType 指定了引用对象的类型。rasterSize 参量指定了与世界文件关联的图像的大小。

示例

示例

全部折叠

将参考投影坐标参考系的正射影像读入工作区。

filename = "concord_ortho_w.tif";
[X,cmap] = imread(filename);

根据图像文件的名称获取世界文件的名称。

worldFileName = getworldfilename(filename);

通过读取世界文件,为正射影像创建一个参考对象。

R = worldfileread(worldFileName,"planar",size(X))
R = 
  MapCellsReference with properties:

            XWorldLimits: [207000 209000]
            YWorldLimits: [911000 913000]
              RasterSize: [2000 2000]
    RasterInterpretation: 'cells'
        ColumnsStartFrom: 'north'
           RowsStartFrom: 'west'
      CellExtentInWorldX: 1
      CellExtentInWorldY: 1
    RasterExtentInWorldX: 2000
    RasterExtentInWorldY: 2000
        XIntrinsicLimits: [0.5 2000.5]
        YIntrinsicLimits: [0.5 2000.5]
      TransformationType: 'rectilinear'
    CoordinateSystemType: 'planar'
            ProjectedCRS: []


将参考地理坐标参考系的图像读入工作区。

filename = "boston_ovr.jpg";
RGB = imread(filename);

根据图像文件的名称获取世界文件的名称。

worldFileName = getworldfilename(filename);

通过读取世界文件,为正射影像创建一个参考对象。

R = worldfileread(worldFileName,"geographic",size(RGB))
R = 
  GeographicCellsReference with properties:

             LatitudeLimits: [42.3052018188767 42.4165064733949]
            LongitudeLimits: [-71.1308390797572 -70.9898400731705]
                 RasterSize: [769 722]
       RasterInterpretation: 'cells'
           ColumnsStartFrom: 'north'
              RowsStartFrom: 'west'
       CellExtentInLatitude: 0.000144739472715501
      CellExtentInLongitude: 0.000195289482807142
     RasterExtentInLatitude: 0.11130465451822
    RasterExtentInLongitude: 0.140999006586757
           XIntrinsicLimits: [0.5 722.5]
           YIntrinsicLimits: [0.5 769.5]
       CoordinateSystemType: 'geographic'
              GeographicCRS: []
                  AngleUnit: 'degree'


输入参数

全部折叠

世界文件的名称,指定为字符串标量或字符向量。

数据类型: char | string

坐标系类型,指定为以下选项之一:

  • "geographic" - 地理坐标系。此选项将创建一个 GeographicCellsReference 对象。

  • "planar" — 平面地图坐标系。此选项将创建一个 MapCellsReference 对象。

与世界文件关联的图像大小,指定为一个包含两个元素的向量 [m n],其中 m 表示图像的行数,n 表示图像的列数。

数据类型: double

输出参量

全部折叠

栅格参考对象,以 GeographicCellsReferenceMapCellsReference 对象的形式返回。栅格参考将图像的每个元素与地理坐标或平面坐标中的某个位置相关联。

版本历史记录

在 R2006a 之前推出

全部展开