# NOT RUN {
# Point to an ENVI data
path <- system.file('exdata', 'obory.dat', package = 'hyperbrick')
# First, let's check the header file
# There are 81 bands. First two are noisy.
# Irradiance is available.
path_hdr <- system.file('exdata', 'obory.hdr', package = 'hyperbrick')
readLines(path_hdr)
# Example 1 - raw values
path <- system.file('exdata', 'obory.dat', package = 'hyperbrick')
b <- buildBrick(path)
print(b)
plot(b, 35)
# Example 2 - set up CRS and compute radiance
br <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
ref_layer = 35, spectral_feature = 'radiance')
print(br)
plot(br, 35)
# Example 3 - DOS correction
dpath <- system.file('exdata', 'obory_dark.dat', package = 'hyperbrick')
brd <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
ref_layer = 35, spectral_feature = 'radiance',
dark_path = dpath)
print(brd)
plot(brd, 35)
# Example 4 - compute reflectance
bre <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
ref_layer = 35, spectral_feature = 'reflectance',
reflectance_method = "irradiance",
dark_path = dpath)
print(bre)
plot(bre, 35)
# Example 5 - there is a white-reference panel in this image
idmax <- which.max(bre[[35]])
plot(bre, 35, asp = 0)
points(xyFromCell(bre[[35]], idmax), pch = 3)
bre2 <- buildBrick(path, hFOV = 36.8, vFOV = 36.8, height = 45,
ref_layer = 35, spectral_feature = 'reflectance',
reflectance_method = "white_panel",
white_path = path, dark_path = dpath)
print(bre2)
plot(bre2, 35)
# }
Run the code above in your browser using DataLab