繁体   English   中英

光栅包如何识别图像的所有波段(层)?

[英]How to do the raster package identify all bands (layers) of a image?

我正在尝试使用栅格数据包读取具有160个反射值和160个像素波长的像素的多层(多波段)图像(ENVI格式[.hdr]),但是当我使用自己开发的代码时,程序仅返回1个波段并关联了refrefance值。 section1=raster("./x") getValuesBlock(section1, row=1, nrows=1, col=1, ncol=1 )

好吧,从它的外观来看,在我看来,您想将特定范围的光栅文件读入R环境,

require("raster")
dir.file<-"dir/file.hdf"
#Reading the first band of the raster image
band1<-raster(dir.file,band=1)

更改raster()方法的band参数的值以控制栅格的band ID。 希望这可以帮助

要创建多层Raster对象,如果层在一个文件中,则应使用brick函数;如果它们在多个文件中,则应使用stack函数。

library(raster)
# example file name
f <- system.file("external/rlogo.grd", package="raster")
b <- brick(f)
b

# a single cell value
b[1]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM