Skip to content

Latest commit

 

History

History
165 lines (116 loc) · 11.3 KB

FlexBRDF_tutorial.md

File metadata and controls

165 lines (116 loc) · 11.3 KB

FlexBRDF

This is a tutorial on how to implement FlexBRDF [1] to normalized illumination conditions with Bidirectional Reflectance Distribution Function (BRDF) in hyperspectral image like AVIRIS-NG. Specially, it it about correcting the images with the terminal command line script.

1. Preparation

Reflectance images and their ancillary datasets are required in order to generate BRDF-corrected reflectance images. Ancillary datasets include solar zenith and azimuth angles, sensor viewing zenith and azimuth angles. Slope and aspect for the terrain are needed for the optional topographic correction. For AVIRIS-like dataset, ancillary dataset is stored in the *_obs_ort / *_obs file from the L1B package , while the reflectance dataset is in the L2 package (AVIRIS-Classic/AVIRIS-NG). For NEON AOP dataset, the ancillary datasets come along with the reflectnace dataset in the HDF5 files.

HyTools and its dependencies are properly installed. It can be verified with the testing code in this section.

2. Configuration

All settings and file paths are specified in a JSON file, which is foremost in the execution of the full procedure. They are supposed to be setup before the actual execution. Some configuration templates can be found here.

To change the settings for specific purposes, user can either directly edit the sample configuration json file, or run the script below to generate a new configuration json file with modified settings.

python ./scripts/configs/image_correct_json_generate.py

A new json file will be generated according to the setting.

Default and recommended settings are described in this example configuration file. The keys settings are introduced in the coming parts.

Choose what to export in the correction outputs

The export part in the configuration determines whether the BRDF model estimation part or the BRDF model application part is to be executed or not. These two parts can be done separatedly in order or done together on the fly.

"export": {
      "coeffs": false,
      "image": true,
      "masks": true,
      "subset_waves": [],
      "output_dir": "/data2/avng/l2/hytools_avng_example/",
      "suffix": "topo_brdf_glint"
},
  • The main results of the whole correction procedure are the images and the correct coefficients. At least one of their exportations should be enabled (set to true). coeffs can be true so that they can be saved for future use, called 'precomputed' coefficients.
  • Mask layers produced during the procedure can also be saved if both image and masks are true.
  • subset_waves is the list denoting which band to export. They are specified by closest wavelgths in nanometers, e.g. [440,550,660] for a 3-band exportation in the visible range. Empty list [] means exporting the full image cube.
  • output_dir and suffix are the about the final location and suffix of the outputs.

Choose how to correct the images

Currently, there are three corrections (TOPO, BRDF, Glint) user can choose from in HyTools. They can all be enabled.

"corrections": [
      "topo",
      "brdf",
      "glint"
],

Order matters in the correction. Some common settings are shown as below.

Correction Setting Meaning
[ ] Empty, no correction
['topo'] Topographic correction only
['brdf'] BRDF correction only, for flat regions
['topo','brdf'] TOPO correction, then BRDF correction
['brdf','glint'] BRDF first, then Glint correction
['topo','brdf','glint'] Three corrections in order

TOPO

Options for topographic methods are ['scs','scs+c','c','cosine','mod_minneart'], corresponding to sun-canopy-sensor method[2], sun-canopy-sensor+C method[2], C method[3], cosine method [3], and modified Minnaert method [3], respectively. The recommended method for topographic correction is "scs+c".

"topo": {
      "type": "scs+c",
      ... ...
      ... ...
},

BRDF

Options for BRDF correction methods are ['flex','universal'], corresponding to FlexBRDF method [1] and universal method.

Geometric kernel can be selected from ['li_sparse','li_dense','li_dense_r','li_dense_r','roujean']. Volumetric kernel can be selected from['ross_thin','ross_thick','hotspot','roujean'].

"brdf": {
    "type": "flex",
    "grouped": true,
    "geometric": "li_dense_r",
    "volume": "ross_thick",
      ... ....
      ... ....      
    "bin_type": "dynamic",
    "num_bins": 18,
    "ndvi_bin_min": 0.05,
    "ndvi_bin_max": 1.0,
    "ndvi_perc_min": 10,
    "ndvi_perc_max": 95,
    "solar_zn_type": "scene"
},   

Although each flight line can be BRDF-corrected independently, it is recommnded in FlexBRDF to put all lines in the same day and at close geographical location in the same group, and estimate the shared BRDF correction coefficients.

FlexBRDF uses NDVI to discriminate various land cover type. It dynamically use N bins of NDVI within an NDVI range. By default, pixels in the flight group will be binned into 18 subgroups based on NDVI percentiles. BRDF coefficients are estimated within each subgroup. Pixels outside [ndvi_bin_min, ndvi_bin_max] are not included for statistics.

Under the setting of BRDF correction, all pixels in the same BRDF flightline group will ultimated be normalized to the illumination condition at the average solar zenith angle of the whole 'scene'.

"num_cpus":2,

If there are more than one flightline in the group for the purpose of BRDF correction, refelctance image should pair with its ancillary file in the confiuration json file. This also means the order of the file list ("input_files" and "anc_files") in the configuration should match with each other. Basically, the number of CPU assigned to RAY should also match the total number of flightlines. In the example, there are two flightlines.

Glint

Options for glint correction include ['hochberg','gao','hedley'], corresponding to the method Hochberg et al., 2003[4], Gao et al., 2021[5], and Hedley et al. 2005[6].

A simplified GUI for generating congig file

This python-based GUI only provides the least options for generating image correction configuration file. It has the most of the functions of image_correct_json_generate.py, but it assumes files of the same group are exclusively in the same directory. It does not provide all the options, and it is rather an example of how the configuration is generated.

GUI for the config file

3. Execution

The actual script for correcting images is image_corret.py. It can either estimate BRDF coefficients, or perform image correction using the coefficients precomputed or on the fly to generate resultant image.

python ./scripts/image_correct.py path/to/the/configuration/json/file

Depending on the configuration settings, various outputs are got in this step.

If image export is enabled, a full image cube ( "subset_waves": []), or a band-subset of image cube (subset_waves": [wavelength1,wavelength2,wavelength3,...] ).

A separated mask file will be generated if both image and mask is set to true in the export part of the configuration.

All resultant images are in ENVI format.

If TOPO/BRDF model coefficients export is enabled, they will be stored in JSON format, and can be used as precomputed coefficients in other hytools scripts (image_correct_json_generate.py or trait_estimate_json_generate.py) or programs in a more customized way. Each image should has its own TOPO/BRDF coefficients JSON file, although BRDF JSON in the same FlexBRDF group share the same set of coefficients.

4. (Optional) Trait prediction

Trait estimated using linear hyperspectral models can be implemented in HyTools. Similar to BRDF correction, the trait maps in image grid format can be generated by combining a mapping script (trait_estimate.py), a model coefficient JSON file (example), and a confguration JSON file (trait_estimate_json_generate.py).

Multiple prediction can be execeuted at the same time, and image reflectance can be corrected by TOPO/BRDF/glint on the fly without the storage-consuming corrected image cube precomputed. The precomputed TOPO/BRDF coefficients from the previous section is therefore playing a critial part.

Reference

[1] Queally, N., Ye, Z., Zheng, T., Chlus, A., Schneider, F., Pavlick, R. P., & Townsend, P. A. (2022). FlexBRDF: A flexible BRDF correction for grouped processing of airborne imaging spectroscopy flightlines. Journal of Geophysical Research: Biogeosciences, 127(1), e2021JG006622. https://doi.org/10.1029/2021JG006622

[2] Scott A. Soenen, Derek R. Peddle, & Craig A. Coburn (2005). SCS+C: A Modified Sun-Canopy-Sensor Topographic Correction in Forested Terrain. IEEE Transactions on Geoscience and Remote Sensing, 43(9), 2148-2159. https://doi.org/10.1109/TGRS.2005.852480

[3] Richter, R., Kellenberger, T., & Kaufmann, H. (2009). Comparison of topographic correction methods. Remote Sensing, 1(3), 184-196. https://doi.org/10.3390/rs1030184

[4] Hochberg, E. J., Andréfouët, S., & Tyler, M. R. (2003). Sea surface correction of high spatial resolution Ikonos images to improve bottom mapping in near-shore environments. IEEE transactions on geoscience and remote sensing, 41(7), 1724-1729. https://doi.org/10.1109/TGRS.2003.815408

[5] Gao, B. C., & Li, R. R. (2021). Correction of sunglint effects in high spatial resolution hyperspectral imagery using SWIR or NIR bands and taking account of spectral variation of refractive index of water. Advances in Environmental and Engineering Research, 2(3), 1-15. https://doi.org/10.21926/aeer.2103017

[6] Hedley, J. D., Harborne, A. R., & Mumby, P. J. (2005). Simple and robust removal of sun glint for mapping shallow‐water benthos. International Journal of Remote Sensing, 26(10), 2107-2112. https://doi.org/10.1080/01431160500034086