RGB图像的植被指数总结

文献中常见的RGB图像的植被指数公式总结

在这里插入图片描述
R,G,B分别对应RG图像的三个波段,r,g,b 分别为R/(R+G+B),G/(R+G+B),B/(R+G+B)

### TIFF文件中波段顺序设置为红绿蓝4,3,2的原因 在遥感领域,TIFF文件通常用于存储多波段的遥感影像数据。这些影像可能由卫星传感器采集而来,例如Landsat系列卫星。对于Landsat 4/5 TM影像而言,其波段编号具有特定的意义: - **Band 4** 对应的是近红外波段 (Near-Infrared),这一波段对植被反射率非常敏感,因此常被用来突出显示植被覆盖区域。 - **Band 3** 是红光波段 (Red),能够反映地表物体的红色特征。 - **Band 2** 则是绿光波段 (Green),主要用于捕捉绿色植物和其他绿色表面的信息。 当将这三个波段组合成一幅彩色图像时,采用 Band 4、Band 3 和 Band 2 的顺序分别映射到 RGB 图像中的 R(红色)、G(绿色)和 B(蓝色),可以形成所谓的“假彩色合成图”。这种配置之所以常用,是因为它能更清晰地区分不同类型的地物[^1]。具体来说: - 植被会在这样的假彩色图像中呈现鲜艳的红色,因为近红外波段(R通道)强烈反映了植被的高反射率。 - 土壤或其他无植被覆盖的地表则会呈现出不同的色调,便于区分。 此外,实验数据如 `data042.rar` 中提到的一景遥感影像包含六个波段的数据,正是基于上述原理进行了波段拆分并保存为 TIFF 格式[^2]。而在实际应用过程中,通过编程实现 NDVI 计算时也涉及到了类似的波段选取逻辑,即利用第三和第四波段来代表红光与近红外波段进行指数计算[^3]。 综上所述,选择波段顺序为红绿蓝对应的 4, 3, 2 主要是为了增强视觉效果以及更好地分析地物特性,这是遥感图像处理中一种标准做法[^4]。 ```python def ndvi_calculate(red_band, nir_band, output_file): """ Calculate the Normalized Difference Vegetation Index (NDVI). Parameters: red_band : rasterio.band object representing Red band. nir_band : rasterio.band object representing Near Infrared band. output_file : string path to save the resulting NDVI image. Returns: None; saves an NDVI tif file at specified location. """ import numpy as np from rasterio import open as rio_open with rio_open(nir_band) as src_nir, rio_open(red_band) as src_red: profile = src_nir.profile nir_data = src_nir.read(1).astype(float) red_data = src_red.read(1).astype(float) # Avoid division by zero errors during calculation ndvi_array = np.where( (nir_data + red_data) == 0., 0., (nir_data - red_data) / (nir_data + red_data)) profile.update(dtype=rasterio.float32, count=1, nodata=-9999) with rio_open(output_file, 'w', **profile) as dst: dst.write(ndvi_array.astype(rasterio.float32), 1) ndvi_calculate('path_to_red_band.tif', 'path_to_nir_band.tif', 'output_ndvi_path.tif') ``` ####
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值