【学习笔记】GDAL对图像的基本操作(未完成)

这段时间用GDAL的一些记录。肯定不完整,哈哈哈哈。

这段时间主要使用了GDAL的几个类:
GDALDataset, GDALRasterBand, GDALDriver

1. GDAL简介

2. GDAL读文件(C++)

 #include "gdal_priv.h" 
#include "cpl_conv.h" // for CPLMalloc()
int main()
{
GDALDataset *poDataset;
GDALAllRegister();
poDataset = (GDALDataset *)GDALOpen(pszFilename, GA_ReadOnly );
if( poDataset == NULL )
{
return 0 ;
}
...
}

  • 首先看下GDAL的数据模型(GDAL DATA MODEL)

A dataset (represented by the GDALDataset class) is an assembly of related raster bands and some information common to them all. In particular the dataset has a concept of the raster size (in pixels and lines) that applies to all the bands. The dataset is also responsible for the georeferencing transform and coordinate system definition of all bands. The dataset itself can also have associated metadata, a list of name/value pairs in string form.


GDALALLRegister()

GDALAllRegister() 是注册所有GDAL的驱动,也就是说注册GDAL所支持的所有格式。


GDALOpen

GDALOpen函数原型为
//——————————————————
//GDALOpen : Open a raster file as a GDALDataset.
//pszFilename为文件路径
//GDALAccess为枚举类型,包含两个值{GA_ReadOnly, GA_Update}
//GA_ReadOnly为只读,GA_Update会更新原始数据
//——————————————————
GDALDatasetH GDALOpen( const char * pszFilename,
GDALAccess eAccess
)

  • 一些GDALDataset的常用接口:

    // 获得图像的格式信息
    GDALDriver* GDALDataset::GetDriver( void )
    /

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值