GFZ / arosics

AROSICS - Automated and Robust Open-Source Image Co-Registration Software
https://git.gfz-potsdam.de/danschef/arosics
Apache License 2.0
146 stars 26 forks source link

How to apply the CoRegPoints of one band tif file to other bands tif file? #32

Open rubikube2237 opened 1 year ago

rubikube2237 commented 1 year ago

Description

Now I have a task, correcting displacements of different bands tif files of one multiband image with Landsat-8 images. Because the limitted CPU numbers, I found correcting one band tif file takes about 5 mins, and I have 10 bands, the time consuming is unbearing in my task. I have tried to tune the _gridres, and I can get the result in 3 mins, with around 3000 tie points. I wonder if this number of points is enough, as well as, the 3 mins for one band is still long to me. I found different bands always calculate same number of tie points, so I guess these tie points are at the same coordinate points in every band tif file. I wonder if I could just calculate the points only once, and applying them to other bands tif file? Because I found the main time usage of the correction is tie points grid calculation, and this will save a lot of time. Or are there other ways to reduce time? I tried to use the global correction method, but I don't know how to judge the quality of the results. Thank you in advance!

roelofvandijkO commented 7 months ago

It seems like your bands are in separate tif files.

Option 1

Arosics can warp multiband images while only determining the warp on one band. Try combining your 10 bands into one file and process that. You can choose the band used for GCP determination with the r_b4match and s_b4match parameters. Only one band will be used for GCP determination. Look into gdalmerge.py for merging the bands.

Option 2

Use the DESHIFTER class. Use one band to determine the warp, then use DESHIFTER(im_target1, CR.coreg_info).correct_shifts() on each image.

Option 3

If you want to do it manually, here is one way: Use gdalwarp from the Python bindings or from the command line. Here is an example.

Again, determine the warp on one band. CRL_local.coreg_info["GCPList"] will return a list of osgeo.gdal.GCP which you can directly use in the gdalwarp call.