This code was developped within the 3DFireLab project, a project funded by the European Union’s Horizon 2020 research and innovation program under the Marie Skłodowska-Curie agreement, grant H2020-MSCA-IF-2019-892463.
If not alreday installed, install compilation tools. In Ubuntu for example,
sudo apt-get install build-essential
For matplotlib plotting you also need some latex packages.
sudo apt-get install dvipng texlive-latex-extra texlive-fonts-recommended cm-super texlive-math-extra
Then, install an anaconda environment with the libraray listed in the yml file you can find here
If you have question handling anaconda env see here
Download a modified version of opencv based on version 3.4.3 with some homebrewed modidication for the ECC function. This is quite old now, to compile it I had to disable manny opencv package that are of no use for the current work. the opencv code source is available here as a tar file or here is my opencv forch waiting for a pull request.
There is instruction for compilation in the dir Opencv_343/opencv
of the tar file. see file compile_ronan.txt
Your anaconda env should be loaded during the compilation.
Once compiled you need to link the python opencv librairy with your anaconda env.
ln -fs $WhereYouUnTarTheOpencV/Opencv_343/Lib/lib/python3.9/site-packages/cv2.cpython-39-x86_64-linux-gnu.so \
$YourAnacondaEnvDir/lib/python3.9/site-packages
Note that if you are not using the same config as in the above yml file, you might have to modify the python version in the linking.
code are in src/
camera info are stored in data_static/
input congifuration file are in input_config/
The whole process of orthorectification need to run in this order:
driver.py
is Algo1refine_lwir.py
is Algo2ssim_prev4.py
is the filteringplot_final_lwir.py
the three first steps are described in Paugam et al 2021.
Ngarkat
is the data set provided with the code.
It can be downloaded on the repository dataverse.csuc.cat
the 'root' directory define in the config file should look like this. Extracting the tar file form the above repository creates the Data directory and all sub directory.
.
├── Data
│ ├── FLIR570
│ │ ├── MAT
│ │ │ ├── > input data: frame_xxxxx.MAT
...
│ └── ignition_time.dat
└── Postproc
├── DEM
│ ├── corrected_terrain_simpleHomography.png
│ ├── Ngarkat_dem.txt
│ ├── ngarkat_ngarkat_dem.npy
│ ├── ngarkat_ngarkat_dem.png
│ └── Ngarkat_plotE_polygon.kml
├── grid_ngarkat.npy
├── grid_ngarkat.prj
├── Instruments_Location
│ ├── cornerFireNames.txt
│ ├── Ngarkat_cf.txt
│ ├── Ngarkat_gcps.kml
│ └── Ngarkat_plotContour.kml
├── LWIR
│ └── > output data processing
└── OrthoData
└── > output final data
All files in Postproc directory are cretaed by the algorightms described bellow.
The two directorties 'Data/' and 'Postproc/' are named in the config file with variables
root_data
and root_postproc
Follows a quick description of each steps to run to perform the orthorectification.
A first algorigthm is aligning the images times series using on the first image that is manually georeference. No fix ground control poins are required. Using the test case
run driver.py -i Ngarkat -m lwir -s False
to get flag description
run driver.py -h
A second algorithm loops again around the images time series focusing on area based alignement of the background scene.
run refine_lwir.py -i Ngarkat -s False
A last algorithm is applying filter to remove outilier images in the time series.
run ssim_prev4.py -i Ngarkat -s False
A python script is plotting LWIR frames in png format as well as creating a netcdf file with all frames.
run plot_final_lwir.py -i Ngarkat --angle 0
the --angle
option is applying a rotation to the north-south orientated images in the png figure only if desired.
example of the LWIR frames times series for the Ngarkat fire is shown below: