Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tie points from the reference and target images #1

Open
PedroVenancio opened this issue Oct 11, 2021 · 26 comments
Open

Tie points from the reference and target images #1

PedroVenancio opened this issue Oct 11, 2021 · 26 comments
Assignees
Labels
enhancement New feature or request

Comments

@PedroVenancio
Copy link

Dear @XavierCLL

Thank you very much for this plugin!

I was testing and I'm thinking if, besides the reprojection, resampling, extent adjustment and masking, it is not supposed to do the image-to-image registration, automatically taking tie points from the reference and target images and making the close alignment? This feature is not [yet!] implemented, am I right?

Thanks!

@XavierCLL
Copy link
Member

Hi Pedro,

You're right, image-to-image registration literally is what you say, I use another "approach" is that base on the properties of the reference image the plugin adjusts the target image to align it, maybe I need to let it know this difference in the process in the readme file. However, this feature is really good to add to this plugin, any help is welcome.

Regards!

@XavierCLL XavierCLL added the enhancement New feature or request label Oct 11, 2021
@PedroVenancio
Copy link
Author

Thank you very much @XavierCLL ! This would be a great enhancement.

Just for reference/orientation, some packages that do the co-registration:

@XavierCLL
Copy link
Member

Thanks so much Pedro for reference these two software to include as part of the new features, and to have a real co-registration plugin. I'm aware that this early version is the most basic approach and it's not literally image-image co-registration, I wanted to start with the basic, let's see how it goes.

@PedroVenancio
Copy link
Author

Hi @XavierCLL

I have been working with AROSICS (https://git.gfz-potsdam.de/danschef/arosics) and I can tell that it performs a very good job co-registering several sensors, so it could be a good option. It requires several dependencies but using conda it's easy to install (https://danschef.git-pages.gfz-potsdam.de/arosics/doc/installation.html).

Best regards!

@XavierCLL
Copy link
Member

Hi @PedroVenancio

Good to know that you work for the AROSICS app, I took a look I found that is one of the best co-registration apps for remote sensing. I've been quite busy but this will be the first new feature for this plugin.

Thanks!

@XavierCLL XavierCLL self-assigned this Oct 30, 2021
@XavierCLL
Copy link
Member

Hi @PedroVenancio

In the latest version (21.11.18), I've implemented the two algorithms of Arosics, global and local. I've tested it and works fine if you have the opportunity to make more tests, It would be great. Thanks.

Regards!
Xavier

@PedroVenancio
Copy link
Author

Hi @XavierCLL

What a wonderful news! This is really awesome!

I've tested here with QGIS 3.16.11, with Python 3.9.5 and it worked, both local and global co-registration!

QGIS version: 3.16.11-Hannover
QGIS code revision: 26cc1c76
Qt version: 5.15.2
GDAL version: 3.3.1
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
Processing algorithm…
Algorithm 'Automated global Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : False, 'IMG_REF' : 'C:/Workspace/AMAZONIA1/S2/L2A_T30TUK_A032166_20210819T111451_2021-08-19_con/RT_T30TUK_A032166_20210819T111451_B0stack_raster.tif', 'INPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif', 'MATCHING_WINDOW' : None, 'MATCH_GSD' : False, 'MAX_SHIFT' : 10, 'OUTPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_global_QGIS.tif', 'RESAMPLING' : 0 }

Image to image Co-Registration:

Processing file: C:\Workspace\AMAZONIA1\AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif

Perform automatic subpixel co-registration with Arosics...

(To check the complete log of the process, open the Python Console)...

DONE

Execution completed in 51.77 seconds
Results:
{'OUTPUT': 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_global_QGIS.tif'}

Loading resulting layers
Algorithm 'Automated global Co-Registration' finished



Python Console
Use iface to access QGIS API interface or Type help(iface) for more info
Security warning: typing commands from an untrusted source can harm your computer
Calculating footprint polygon and actual data corner coordinates for reference image...

Polygonize progress     |--------------------------------------------------| 0.0% Complete  => 0:00:00
Polygonize progress     |=-------------------------------------------------| 1.0% Complete  => 0:00:00
Polygonize progress     |=-------------------------------------------------| 2.0% Complete  => 0:00:00
Polygonize progress     |==------------------------------------------------| 3.0% Complete  => 0:00:00
Polygonize progress     |==------------------------------------------------| 4.0% Complete  => 0:00:00
Polygonize progress     |==------------------------------------------------| 5.0% Complete  => 0:00:00
Polygonize progress     |===-----------------------------------------------| 6.0% Complete  => 0:00:00
Polygonize progress     |====----------------------------------------------| 7.0% Complete  => 0:00:00
Polygonize progress     |====----------------------------------------------| 8.0% Complete  => 0:00:00
Polygonize progress     |=====---------------------------------------------| 9.0% Complete  => 0:00:00
Polygonize progress     |=====---------------------------------------------| 10.0% Complete  => 0:00:00
Polygonize progress     |======--------------------------------------------| 11.0% Complete  => 0:00:00
Polygonize progress     |======--------------------------------------------| 12.0% Complete  => 0:00:00
Polygonize progress     |=======-------------------------------------------| 13.0% Complete  => 0:00:00
Polygonize progress     |=======-------------------------------------------| 14.0% Complete  => 0:00:00
Polygonize progress     |========------------------------------------------| 15.0% Complete  => 0:00:00
Polygonize progress     |========------------------------------------------| 16.0% Complete  => 0:00:00
Polygonize progress     |=========-----------------------------------------| 17.0% Complete  => 0:00:00
Polygonize progress     |=========-----------------------------------------| 18.0% Complete  => 0:00:00
Polygonize progress     |==========----------------------------------------| 19.0% Complete  => 0:00:00
Polygonize progress     |==========----------------------------------------| 20.0% Complete  => 0:00:00
Polygonize progress     |===========---------------------------------------| 21.0% Complete  => 0:00:00
Polygonize progress     |===========---------------------------------------| 22.0% Complete  => 0:00:00
Polygonize progress     |============--------------------------------------| 23.0% Complete  => 0:00:00
Polygonize progress     |============--------------------------------------| 24.0% Complete  => 0:00:00
Polygonize progress     |=============-------------------------------------| 25.0% Complete  => 0:00:00
Polygonize progress     |=============-------------------------------------| 26.0% Complete  => 0:00:00
Polygonize progress     |==============------------------------------------| 27.0% Complete  => 0:00:00
Polygonize progress     |==============------------------------------------| 28.0% Complete  => 0:00:00
Polygonize progress     |===============-----------------------------------| 29.0% Complete  => 0:00:00
Polygonize progress     |===============-----------------------------------| 30.0% Complete  => 0:00:00
Polygonize progress     |================----------------------------------| 31.0% Complete  => 0:00:00
Polygonize progress     |================----------------------------------| 32.0% Complete  => 0:00:00
Polygonize progress     |=================---------------------------------| 33.0% Complete  => 0:00:00
Polygonize progress     |=================---------------------------------| 34.0% Complete  => 0:00:00
Polygonize progress     |==================--------------------------------| 35.0% Complete  => 0:00:00
Polygonize progress     |==================--------------------------------| 36.0% Complete  => 0:00:00
Polygonize progress     |==================--------------------------------| 37.0% Complete  => 0:00:00
Polygonize progress     |===================-------------------------------| 38.0% Complete  => 0:00:00
Polygonize progress     |====================------------------------------| 39.0% Complete  => 0:00:00
Polygonize progress     |====================------------------------------| 40.0% Complete  => 0:00:00
Polygonize progress     |=====================-----------------------------| 41.0% Complete  => 0:00:00
Polygonize progress     |=====================-----------------------------| 42.0% Complete  => 0:00:00
Polygonize progress     |======================----------------------------| 43.0% Complete  => 0:00:00
Polygonize progress     |======================----------------------------| 44.0% Complete  => 0:00:00
Polygonize progress     |=======================---------------------------| 45.0% Complete  => 0:00:00
Polygonize progress     |=======================---------------------------| 46.0% Complete  => 0:00:00
Polygonize progress     |========================--------------------------| 47.0% Complete  => 0:00:00
Polygonize progress     |========================--------------------------| 48.0% Complete  => 0:00:00
Polygonize progress     |=========================-------------------------| 49.0% Complete  => 0:00:00
Polygonize progress     |=========================-------------------------| 50.0% Complete  => 0:00:00
Polygonize progress     |==========================------------------------| 51.0% Complete  => 0:00:00
Polygonize progress     |==========================------------------------| 52.0% Complete  => 0:00:00
Polygonize progress     |===========================-----------------------| 53.0% Complete  => 0:00:00
Polygonize progress     |===========================-----------------------| 54.0% Complete  => 0:00:00
Polygonize progress     |============================----------------------| 55.0% Complete  => 0:00:00
Polygonize progress     |============================----------------------| 56.0% Complete  => 0:00:00
Polygonize progress     |=============================---------------------| 57.0% Complete  => 0:00:00
Polygonize progress     |=============================---------------------| 58.0% Complete  => 0:00:00
Polygonize progress     |==============================--------------------| 59.0% Complete  => 0:00:00
Polygonize progress     |==============================--------------------| 60.0% Complete  => 0:00:00
Polygonize progress     |===============================-------------------| 61.0% Complete  => 0:00:00
Polygonize progress     |===============================-------------------| 62.0% Complete  => 0:00:00
Polygonize progress     |================================------------------| 63.0% Complete  => 0:00:00
Polygonize progress     |================================------------------| 64.0% Complete  => 0:00:01
Polygonize progress     |=================================-----------------| 65.0% Complete  => 0:00:01
Polygonize progress     |=================================-----------------| 66.0% Complete  => 0:00:01
Polygonize progress     |==================================----------------| 67.0% Complete  => 0:00:01
Polygonize progress     |==================================----------------| 68.0% Complete  => 0:00:01
Polygonize progress     |===================================---------------| 69.0% Complete  => 0:00:01
Polygonize progress     |===================================---------------| 70.0% Complete  => 0:00:01
Polygonize progress     |====================================--------------| 71.0% Complete  => 0:00:01
Polygonize progress     |====================================--------------| 72.0% Complete  => 0:00:01
Polygonize progress     |====================================--------------| 73.0% Complete  => 0:00:01
Polygonize progress     |=====================================-------------| 74.0% Complete  => 0:00:01
Polygonize progress     |======================================------------| 75.0% Complete  => 0:00:01
Polygonize progress     |======================================------------| 76.0% Complete  => 0:00:01
Polygonize progress     |=======================================-----------| 77.0% Complete  => 0:00:01
Polygonize progress     |=======================================-----------| 78.0% Complete  => 0:00:01
Polygonize progress     |========================================----------| 79.0% Complete  => 0:00:01
Polygonize progress     |========================================----------| 80.0% Complete  => 0:00:01
Polygonize progress     |=========================================---------| 81.0% Complete  => 0:00:01
Polygonize progress     |=========================================---------| 82.0% Complete  => 0:00:01
Polygonize progress     |==========================================--------| 83.0% Complete  => 0:00:01
Polygonize progress     |==========================================--------| 84.0% Complete  => 0:00:01
Polygonize progress     |===========================================-------| 85.0% Complete  => 0:00:01
Polygonize progress     |===========================================-------| 86.0% Complete  => 0:00:01
Polygonize progress     |============================================------| 87.0% Complete  => 0:00:01
Polygonize progress     |============================================------| 88.0% Complete  => 0:00:01
Polygonize progress     |=============================================-----| 89.0% Complete  => 0:00:01
Polygonize progress     |=============================================-----| 90.0% Complete  => 0:00:01
Polygonize progress     |==============================================----| 91.0% Complete  => 0:00:01
Polygonize progress     |==============================================----| 92.0% Complete  => 0:00:01
Polygonize progress     |===============================================---| 93.0% Complete  => 0:00:01
Polygonize progress     |===============================================---| 94.0% Complete  => 0:00:01
Polygonize progress     |================================================--| 95.0% Complete  => 0:00:01
Polygonize progress     |================================================--| 96.0% Complete  => 0:00:01
Polygonize progress     |=================================================-| 97.0% Complete  => 0:00:01
Polygonize progress     |=================================================-| 98.0% Complete  => 0:00:01
Polygonize progress     |==================================================| 99.0% Complete  => 0:00:01
Polygonize progress     |==================================================| 100.0% Complete  => 0:00:01
Bounding box of calculated footprint for reference image:
	(300000.0, 4390200.0, 409800.0, 4500000.0)
Calculating footprint polygon and actual data corner coordinates for image to be shifted...
Bounding box of calculated footprint for image to be shifted:
	(300000.0, 4390208.0, 409824.0, 4500032.0)
Matching window position (X,Y): 354900.0/4445104.0
Detected integer shifts (X/Y):                            -3/9
Detected subpixel shifts (X/Y):                           0.15145010410667434/-0.2905340787655373
Calculated total shifts in fft pixel units (X/Y):         -2.8485498958933255/8.709465921234463
Calculated total shifts in reference pixel units (X/Y):   -2.8485498958933255/8.709465921234463
Calculated total shifts in target pixel units (X/Y):      -2.8485498958933255/8.709465921234463
Calculated map shifts (X,Y):				  -182.30719333718298/-557.4058189587668
Calculated absolute shift vector length in map units:     586.4615586307209
Calculated angle of shift vector in degrees from North:   18.111040352016232
Original map info: ['UTM', 1.0, 1.0, 300000.0, 4500032.0, 64.0, 64.0, 30, 'North', 'WGS-84']
Updated map info:  ['UTM', 1.0, 1.0, '299817.6928066628', '4499474.594181041', 64.0, 64.0, 30, 'North', 'WGS-84']
Image similarity within the matching window (SSIM before/after correction): 0.0652 => 0.8700
Estimated reliability of the calculated shifts:  68.5 %
Correcting geometric shifts...
NOTE: The detected shift is corrected by updating the map info of the target image only, i.e., without any resampling. Set the 'align_grids' parameter to True if you need the target and the reference coordinate grids to be aligned.
Writing GeoArray of size (1716, 1716, 4) to C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_global_QGIS.tif.
QGIS version: 3.16.11-Hannover
QGIS code revision: 26cc1c76
Qt version: 5.15.2
GDAL version: 3.3.1
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
Processing algorithm…
Algorithm 'Automated local Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : False, 'GRID_RES' : 200, 'IMG_REF' : 'C:/Workspace/AMAZONIA1/S2/L2A_T30TUK_A032166_20210819T111451_2021-08-19_con/RT_T30TUK_A032166_20210819T111451_B0stack_raster.tif', 'INPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif', 'MATCH_GSD' : False, 'MAX_SHIFT' : 10, 'OUTPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_local_QGIS.tif', 'RESAMPLING' : 0, 'WINDOW_SIZE' : 64 }

Image to image Co-Registration:

Processing file: C:\Workspace\AMAZONIA1\AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif

Perform automatic subpixel co-registration with Arosics...

(To check the complete log of the process, open the Python Console)...

Warning: in Windows due to restrictions to enable multiprocessing inside Qgis, the process could take longer. Continue with one core ...

DONE

Execution completed in 1909.25 seconds
Results:
{'OUTPUT': 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_local_QGIS.tif'}

Loading resulting layers
Algorithm 'Automated local Co-Registration' finished



Python Console
Use iface to access QGIS API interface or Type help(iface) for more info
Security warning: typing commands from an untrusted source can harm your computer

Calculating footprint polygon and actual data corner coordinates for reference image...

Polygonize progress     |--------------------------------------------------| 0.0% Complete  => 0:00:00
Polygonize progress     |=-------------------------------------------------| 1.0% Complete  => 0:00:00
Polygonize progress     |=-------------------------------------------------| 2.0% Complete  => 0:00:00
Polygonize progress     |==------------------------------------------------| 3.0% Complete  => 0:00:00
Polygonize progress     |==------------------------------------------------| 4.0% Complete  => 0:00:00
Polygonize progress     |==------------------------------------------------| 5.0% Complete  => 0:00:00
Polygonize progress     |===-----------------------------------------------| 6.0% Complete  => 0:00:00
Polygonize progress     |====----------------------------------------------| 7.0% Complete  => 0:00:00
Polygonize progress     |====----------------------------------------------| 8.0% Complete  => 0:00:00
Polygonize progress     |=====---------------------------------------------| 9.0% Complete  => 0:00:00
Polygonize progress     |=====---------------------------------------------| 10.0% Complete  => 0:00:00
Polygonize progress     |======--------------------------------------------| 11.0% Complete  => 0:00:00
Polygonize progress     |======--------------------------------------------| 12.0% Complete  => 0:00:00
Polygonize progress     |=======-------------------------------------------| 13.0% Complete  => 0:00:00
Polygonize progress     |=======-------------------------------------------| 14.0% Complete  => 0:00:00
Polygonize progress     |========------------------------------------------| 15.0% Complete  => 0:00:00
Polygonize progress     |========------------------------------------------| 16.0% Complete  => 0:00:00
Polygonize progress     |=========-----------------------------------------| 17.0% Complete  => 0:00:00
Polygonize progress     |=========-----------------------------------------| 18.0% Complete  => 0:00:00
Polygonize progress     |==========----------------------------------------| 19.0% Complete  => 0:00:00
Polygonize progress     |==========----------------------------------------| 20.0% Complete  => 0:00:00
Polygonize progress     |===========---------------------------------------| 21.0% Complete  => 0:00:00
Polygonize progress     |===========---------------------------------------| 22.0% Complete  => 0:00:00
Polygonize progress     |============--------------------------------------| 23.0% Complete  => 0:00:00
Polygonize progress     |============--------------------------------------| 24.0% Complete  => 0:00:00
Polygonize progress     |=============-------------------------------------| 25.0% Complete  => 0:00:00
Polygonize progress     |=============-------------------------------------| 26.0% Complete  => 0:00:00
Polygonize progress     |==============------------------------------------| 27.0% Complete  => 0:00:00
Polygonize progress     |==============------------------------------------| 28.0% Complete  => 0:00:00
Polygonize progress     |===============-----------------------------------| 29.0% Complete  => 0:00:00
Polygonize progress     |===============-----------------------------------| 30.0% Complete  => 0:00:00
Polygonize progress     |================----------------------------------| 31.0% Complete  => 0:00:00
Polygonize progress     |================----------------------------------| 32.0% Complete  => 0:00:00
Polygonize progress     |=================---------------------------------| 33.0% Complete  => 0:00:00
Polygonize progress     |=================---------------------------------| 34.0% Complete  => 0:00:00
Polygonize progress     |==================--------------------------------| 35.0% Complete  => 0:00:00
Polygonize progress     |==================--------------------------------| 36.0% Complete  => 0:00:00
Polygonize progress     |==================--------------------------------| 37.0% Complete  => 0:00:00
Polygonize progress     |===================-------------------------------| 38.0% Complete  => 0:00:00
Polygonize progress     |====================------------------------------| 39.0% Complete  => 0:00:00
Polygonize progress     |====================------------------------------| 40.0% Complete  => 0:00:00
Polygonize progress     |=====================-----------------------------| 41.0% Complete  => 0:00:00
Polygonize progress     |=====================-----------------------------| 42.0% Complete  => 0:00:00
Polygonize progress     |======================----------------------------| 43.0% Complete  => 0:00:00
Polygonize progress     |======================----------------------------| 44.0% Complete  => 0:00:00
Polygonize progress     |=======================---------------------------| 45.0% Complete  => 0:00:00
Polygonize progress     |=======================---------------------------| 46.0% Complete  => 0:00:00
Polygonize progress     |========================--------------------------| 47.0% Complete  => 0:00:00
Polygonize progress     |========================--------------------------| 48.0% Complete  => 0:00:01
Polygonize progress     |=========================-------------------------| 49.0% Complete  => 0:00:01
Polygonize progress     |=========================-------------------------| 50.0% Complete  => 0:00:01
Polygonize progress     |==========================------------------------| 51.0% Complete  => 0:00:01
Polygonize progress     |==========================------------------------| 52.0% Complete  => 0:00:01
Polygonize progress     |===========================-----------------------| 53.0% Complete  => 0:00:01
Polygonize progress     |===========================-----------------------| 54.0% Complete  => 0:00:01
Polygonize progress     |============================----------------------| 55.0% Complete  => 0:00:01
Polygonize progress     |============================----------------------| 56.0% Complete  => 0:00:01
Polygonize progress     |=============================---------------------| 57.0% Complete  => 0:00:01
Polygonize progress     |=============================---------------------| 58.0% Complete  => 0:00:01
Polygonize progress     |==============================--------------------| 59.0% Complete  => 0:00:01
Polygonize progress     |==============================--------------------| 60.0% Complete  => 0:00:01
Polygonize progress     |===============================-------------------| 61.0% Complete  => 0:00:01
Polygonize progress     |===============================-------------------| 62.0% Complete  => 0:00:01
Polygonize progress     |================================------------------| 63.0% Complete  => 0:00:01
Polygonize progress     |================================------------------| 64.0% Complete  => 0:00:01
Polygonize progress     |=================================-----------------| 65.0% Complete  => 0:00:01
Polygonize progress     |=================================-----------------| 66.0% Complete  => 0:00:01
Polygonize progress     |==================================----------------| 67.0% Complete  => 0:00:01
Polygonize progress     |==================================----------------| 68.0% Complete  => 0:00:01
Polygonize progress     |===================================---------------| 69.0% Complete  => 0:00:01
Polygonize progress     |===================================---------------| 70.0% Complete  => 0:00:01
Polygonize progress     |====================================--------------| 71.0% Complete  => 0:00:01
Polygonize progress     |====================================--------------| 72.0% Complete  => 0:00:01
Polygonize progress     |====================================--------------| 73.0% Complete  => 0:00:01
Polygonize progress     |=====================================-------------| 74.0% Complete  => 0:00:01
Polygonize progress     |======================================------------| 75.0% Complete  => 0:00:01
Polygonize progress     |======================================------------| 76.0% Complete  => 0:00:01
Polygonize progress     |=======================================-----------| 77.0% Complete  => 0:00:01
Polygonize progress     |=======================================-----------| 78.0% Complete  => 0:00:01
Polygonize progress     |========================================----------| 79.0% Complete  => 0:00:01
Polygonize progress     |========================================----------| 80.0% Complete  => 0:00:01
Polygonize progress     |=========================================---------| 81.0% Complete  => 0:00:01
Polygonize progress     |=========================================---------| 82.0% Complete  => 0:00:01
Polygonize progress     |==========================================--------| 83.0% Complete  => 0:00:01
Polygonize progress     |==========================================--------| 84.0% Complete  => 0:00:01
Polygonize progress     |===========================================-------| 85.0% Complete  => 0:00:01
Polygonize progress     |===========================================-------| 86.0% Complete  => 0:00:01
Polygonize progress     |============================================------| 87.0% Complete  => 0:00:01
Polygonize progress     |============================================------| 88.0% Complete  => 0:00:01
Polygonize progress     |=============================================-----| 89.0% Complete  => 0:00:01
Polygonize progress     |=============================================-----| 90.0% Complete  => 0:00:01
Polygonize progress     |==============================================----| 91.0% Complete  => 0:00:01
Polygonize progress     |==============================================----| 92.0% Complete  => 0:00:01
Polygonize progress     |===============================================---| 93.0% Complete  => 0:00:01
Polygonize progress     |===============================================---| 94.0% Complete  => 0:00:01
Polygonize progress     |================================================--| 95.0% Complete  => 0:00:01
Polygonize progress     |================================================--| 96.0% Complete  => 0:00:01
Polygonize progress     |=================================================-| 97.0% Complete  => 0:00:01
Polygonize progress     |=================================================-| 98.0% Complete  => 0:00:01
Polygonize progress     |==================================================| 99.0% Complete  => 0:00:01
Polygonize progress     |==================================================| 100.0% Complete  => 0:00:01
Bounding box of calculated footprint for reference image:
	(300000.0, 4390200.0, 409800.0, 4500000.0)
Calculating footprint polygon and actual data corner coordinates for image to be shifted...
Bounding box of calculated footprint for image to be shifted:
	(300000.0, 4390208.0, 409824.0, 4500032.0)
Matching window position (X,Y): 354900.0/4445104.0
Initializing tie points grid...
Calculating tie point grid (72 points) on 1 CPU core...

	progress: |=-------------------------------------------------| 1.4% Complete  => 0:00:00
	progress: |=-------------------------------------------------| 2.8% Complete  => 0:00:32
	progress: |==------------------------------------------------| 4.2% Complete  => 0:01:04
	progress: |===-----------------------------------------------| 5.6% Complete  => 0:01:36
	progress: |===-----------------------------------------------| 6.9% Complete  => 0:02:08
	progress: |====----------------------------------------------| 8.3% Complete  => 0:02:42
	progress: |=====---------------------------------------------| 9.7% Complete  => 0:03:14
	progress: |======--------------------------------------------| 11.1% Complete  => 0:03:46
	progress: |======--------------------------------------------| 12.5% Complete  => 0:04:16
	progress: |=======-------------------------------------------| 13.9% Complete  => 0:04:46
	progress: |========------------------------------------------| 15.3% Complete  => 0:05:11
	progress: |========------------------------------------------| 16.7% Complete  => 0:05:37
	progress: |=========-----------------------------------------| 18.1% Complete  => 0:05:38
	progress: |==========----------------------------------------| 19.4% Complete  => 0:06:05
	progress: |==========----------------------------------------| 20.8% Complete  => 0:06:31
	progress: |===========---------------------------------------| 22.2% Complete  => 0:06:58
	progress: |============--------------------------------------| 23.6% Complete  => 0:07:23
	progress: |============--------------------------------------| 25.0% Complete  => 0:07:49
	progress: |=============-------------------------------------| 26.4% Complete  => 0:08:15
	progress: |==============------------------------------------| 27.8% Complete  => 0:08:40
	progress: |===============-----------------------------------| 29.2% Complete  => 0:09:06
	progress: |===============-----------------------------------| 30.6% Complete  => 0:09:32
	progress: |================----------------------------------| 31.9% Complete  => 0:09:58
	progress: |=================---------------------------------| 33.3% Complete  => 0:10:23
	progress: |=================---------------------------------| 34.7% Complete  => 0:10:49
	progress: |==================--------------------------------| 36.1% Complete  => 0:11:15
	progress: |===================-------------------------------| 37.5% Complete  => 0:11:41
	progress: |===================-------------------------------| 38.9% Complete  => 0:12:09
	progress: |====================------------------------------| 40.3% Complete  => 0:12:36
	progress: |=====================-----------------------------| 41.7% Complete  => 0:13:04
	progress: |======================----------------------------| 43.1% Complete  => 0:13:32
	progress: |======================----------------------------| 44.4% Complete  => 0:13:59
	progress: |=======================---------------------------| 45.8% Complete  => 0:14:27
	progress: |========================--------------------------| 47.2% Complete  => 0:14:54
	progress: |========================--------------------------| 48.6% Complete  => 0:15:20
	progress: |=========================-------------------------| 50.0% Complete  => 0:15:50
	progress: |==========================------------------------| 51.4% Complete  => 0:16:16
	progress: |==========================------------------------| 52.8% Complete  => 0:16:40
	progress: |===========================-----------------------| 54.2% Complete  => 0:17:04
	progress: |============================----------------------| 55.6% Complete  => 0:17:27
	progress: |============================----------------------| 56.9% Complete  => 0:17:51
	progress: |=============================---------------------| 58.3% Complete  => 0:18:16
	progress: |==============================--------------------| 59.7% Complete  => 0:18:42
	progress: |===============================-------------------| 61.1% Complete  => 0:19:05
	progress: |===============================-------------------| 62.5% Complete  => 0:19:29
	progress: |================================------------------| 63.9% Complete  => 0:19:53
	progress: |=================================-----------------| 65.3% Complete  => 0:20:17
	progress: |=================================-----------------| 66.7% Complete  => 0:20:39
	progress: |==================================----------------| 68.1% Complete  => 0:21:02
	progress: |===================================---------------| 69.4% Complete  => 0:21:26
	progress: |===================================---------------| 70.8% Complete  => 0:21:49
	progress: |====================================--------------| 72.2% Complete  => 0:22:13
	progress: |=====================================-------------| 73.6% Complete  => 0:22:37
	progress: |======================================------------| 75.0% Complete  => 0:23:02
	progress: |======================================------------| 76.4% Complete  => 0:23:26
	progress: |=======================================-----------| 77.8% Complete  => 0:23:51
	progress: |========================================----------| 79.2% Complete  => 0:24:15
	progress: |========================================----------| 80.6% Complete  => 0:24:39
	progress: |=========================================---------| 81.9% Complete  => 0:25:03
	progress: |==========================================--------| 83.3% Complete  => 0:25:28
	progress: |==========================================--------| 84.7% Complete  => 0:25:52
	progress: |===========================================-------| 86.1% Complete  => 0:26:15
	progress: |============================================------| 87.5% Complete  => 0:26:40
	progress: |============================================------| 88.9% Complete  => 0:27:04
	progress: |=============================================-----| 90.3% Complete  => 0:27:28
	progress: |==============================================----| 91.7% Complete  => 0:27:52
	progress: |===============================================---| 93.1% Complete  => 0:28:16
	progress: |===============================================---| 94.4% Complete  => 0:28:41
	progress: |================================================--| 95.8% Complete  => 0:29:05
	progress: |=================================================-| 97.2% Complete  => 0:29:29
	progress: |=================================================-| 98.6% Complete  => 0:29:53
	progress: |==================================================| 100.0% Complete  => 0:30:17
Found 71 matches.
Performing validity checks...
9 tie points flagged by level 1 filtering (reliability).
0 tie points flagged by level 2 filtering (SSIM).
9 tie points flagged by level 3 filtering (RANSAC)
53 valid tie points remain after filtering.
Correcting geometric shifts...

Translating progress |--------------------------------------------------| 0.0% Complete  => 0:00:00
Translating progress |============--------------------------------------| 25.0% Complete  => 0:00:00
Translating progress |=========================-------------------------| 50.0% Complete  => 0:00:00
Translating progress |======================================------------| 75.0% Complete  => 0:00:00
Translating progress |==================================================| 100.0% Complete  => 0:00:00

Warping progress     |--------------------------------------------------| 0.0% Complete  => 0:00:00
Warping progress     |=-------------------------------------------------| 1.0% Complete  => 0:00:00
Warping progress     |=-------------------------------------------------| 2.1% Complete  => 0:00:00
Warping progress     |==------------------------------------------------| 3.1% Complete  => 0:00:00
Warping progress     |==------------------------------------------------| 4.0% Complete  => 0:00:00
Warping progress     |===-----------------------------------------------| 5.0% Complete  => 0:00:00
Warping progress     |===-----------------------------------------------| 6.0% Complete  => 0:00:00
Warping progress     |====----------------------------------------------| 7.1% Complete  => 0:00:00
Warping progress     |====----------------------------------------------| 8.0% Complete  => 0:00:00
Warping progress     |=====---------------------------------------------| 9.0% Complete  => 0:00:00
Warping progress     |=====---------------------------------------------| 10.0% Complete  => 0:00:00
Warping progress     |======--------------------------------------------| 11.0% Complete  => 0:00:00
Warping progress     |======--------------------------------------------| 12.0% Complete  => 0:00:00
Warping progress     |=======-------------------------------------------| 13.1% Complete  => 0:00:00
Warping progress     |=======-------------------------------------------| 14.0% Complete  => 0:00:00
Warping progress     |========------------------------------------------| 15.0% Complete  => 0:00:00
Warping progress     |========------------------------------------------| 16.1% Complete  => 0:00:00
Warping progress     |=========-----------------------------------------| 17.0% Complete  => 0:00:00
Warping progress     |=========-----------------------------------------| 18.0% Complete  => 0:00:00
Warping progress     |==========----------------------------------------| 19.1% Complete  => 0:00:00
Warping progress     |==========----------------------------------------| 20.0% Complete  => 0:00:00
Warping progress     |===========---------------------------------------| 21.0% Complete  => 0:00:00
Warping progress     |===========---------------------------------------| 22.0% Complete  => 0:00:00
Warping progress     |============--------------------------------------| 23.0% Complete  => 0:00:00
Warping progress     |============--------------------------------------| 24.0% Complete  => 0:00:00
Warping progress     |=============-------------------------------------| 25.1% Complete  => 0:00:00
Warping progress     |=============-------------------------------------| 26.0% Complete  => 0:00:00
Warping progress     |==============------------------------------------| 27.1% Complete  => 0:00:00
Warping progress     |==============------------------------------------| 28.0% Complete  => 0:00:00
Warping progress     |===============-----------------------------------| 29.0% Complete  => 0:00:00
Warping progress     |===============-----------------------------------| 30.0% Complete  => 0:00:00
Warping progress     |================----------------------------------| 31.0% Complete  => 0:00:00
Warping progress     |================----------------------------------| 32.1% Complete  => 0:00:00
Warping progress     |=================---------------------------------| 33.0% Complete  => 0:00:00
Warping progress     |=================---------------------------------| 34.0% Complete  => 0:00:00
Warping progress     |==================--------------------------------| 35.0% Complete  => 0:00:00
Warping progress     |==================--------------------------------| 36.0% Complete  => 0:00:00
Warping progress     |===================-------------------------------| 37.1% Complete  => 0:00:00
Warping progress     |===================-------------------------------| 38.1% Complete  => 0:00:00
Warping progress     |====================------------------------------| 39.0% Complete  => 0:00:00
Warping progress     |====================------------------------------| 40.0% Complete  => 0:00:00
Warping progress     |=====================-----------------------------| 41.0% Complete  => 0:00:00
Warping progress     |=====================-----------------------------| 42.0% Complete  => 0:00:00
Warping progress     |======================----------------------------| 43.0% Complete  => 0:00:00
Warping progress     |======================----------------------------| 44.1% Complete  => 0:00:00
Warping progress     |=======================---------------------------| 45.0% Complete  => 0:00:00
Warping progress     |=======================---------------------------| 46.0% Complete  => 0:00:00
Warping progress     |========================--------------------------| 47.0% Complete  => 0:00:00
Warping progress     |========================--------------------------| 48.0% Complete  => 0:00:00
Warping progress     |=========================-------------------------| 49.1% Complete  => 0:00:00
Warping progress     |=========================-------------------------| 50.0% Complete  => 0:00:00
Warping progress     |==========================------------------------| 51.0% Complete  => 0:00:00
Warping progress     |==========================------------------------| 52.0% Complete  => 0:00:00
Warping progress     |===========================-----------------------| 53.0% Complete  => 0:00:00
Warping progress     |===========================-----------------------| 54.0% Complete  => 0:00:01
Warping progress     |============================----------------------| 55.1% Complete  => 0:00:01
Warping progress     |============================----------------------| 56.0% Complete  => 0:00:01
Warping progress     |=============================---------------------| 57.1% Complete  => 0:00:01
Warping progress     |=============================---------------------| 58.0% Complete  => 0:00:01
Warping progress     |==============================--------------------| 59.0% Complete  => 0:00:01
Warping progress     |==============================--------------------| 60.0% Complete  => 0:00:01
Warping progress     |===============================-------------------| 61.0% Complete  => 0:00:01
Warping progress     |===============================-------------------| 62.1% Complete  => 0:00:01
Warping progress     |================================------------------| 63.1% Complete  => 0:00:01
Warping progress     |================================------------------| 64.0% Complete  => 0:00:01
Warping progress     |=================================-----------------| 65.0% Complete  => 0:00:01
Warping progress     |=================================-----------------| 66.0% Complete  => 0:00:01
Warping progress     |==================================----------------| 67.0% Complete  => 0:00:01
Warping progress     |==================================----------------| 68.0% Complete  => 0:00:01
Warping progress     |===================================---------------| 69.1% Complete  => 0:00:01
Warping progress     |===================================---------------| 70.0% Complete  => 0:00:01
Warping progress     |====================================--------------| 71.1% Complete  => 0:00:01
Warping progress     |====================================--------------| 72.0% Complete  => 0:00:01
Warping progress     |=====================================-------------| 73.0% Complete  => 0:00:01
Warping progress     |=====================================-------------| 74.1% Complete  => 0:00:01
Warping progress     |======================================------------| 75.0% Complete  => 0:00:01
Warping progress     |======================================------------| 76.0% Complete  => 0:00:01
Warping progress     |=======================================-----------| 77.0% Complete  => 0:00:01
Warping progress     |=======================================-----------| 78.0% Complete  => 0:00:01
Warping progress     |========================================----------| 79.0% Complete  => 0:00:01
Warping progress     |========================================----------| 80.0% Complete  => 0:00:01
Warping progress     |=========================================---------| 81.0% Complete  => 0:00:01
Warping progress     |=========================================---------| 82.1% Complete  => 0:00:01
Warping progress     |==========================================--------| 83.0% Complete  => 0:00:01
Warping progress     |==========================================--------| 84.0% Complete  => 0:00:01
Warping progress     |===========================================-------| 85.0% Complete  => 0:00:01
Warping progress     |===========================================-------| 86.0% Complete  => 0:00:01
Warping progress     |============================================------| 87.0% Complete  => 0:00:01
Warping progress     |============================================------| 88.1% Complete  => 0:00:01
Warping progress     |=============================================-----| 89.0% Complete  => 0:00:01
Warping progress     |=============================================-----| 90.0% Complete  => 0:00:01
Warping progress     |==============================================----| 91.0% Complete  => 0:00:02
Warping progress     |==============================================----| 92.0% Complete  => 0:00:02
Warping progress     |===============================================---| 93.0% Complete  => 0:00:02
Warping progress     |===============================================---| 94.1% Complete  => 0:00:02
Warping progress     |================================================--| 95.0% Complete  => 0:00:02
Warping progress     |================================================--| 96.0% Complete  => 0:00:02
Warping progress     |=================================================-| 97.0% Complete  => 0:00:02
Warping progress     |=================================================-| 98.0% Complete  => 0:00:02
Warping progress     |==================================================| 99.0% Complete  => 0:00:02
Warping progress     |==================================================| 100.0% Complete  => 0:00:02
Writing GeoArray of size (1716, 1716, 4) to C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_local_QGIS.tif.

However, I could not run it with QGIS 3.22.0:

QGIS version: 3.22.0-Białowieża
QGIS code revision: 9c2613c4d85
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.3.3
GEOS version: 3.10.0-CAPI-1.16.0
PROJ version: Rel. 8.2.0, November 1st, 2021
PDAL version: 2.3.0 (git-version: eac774)
Algorithm started at: 2021-11-19T10:32:38
Algorithm 'Automated global Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : False, 'IMG_REF' : 'C:/Workspace/AMAZONIA1/S2/L2A_T30TUK_A032166_20210819T111451_2021-08-19_con/RT_T30TUK_A032166_20210819T111451_B0stack_raster.tif', 'INPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif', 'MATCHING_WINDOW' : None, 'MATCH_GSD' : False, 'MAX_SHIFT' : 10, 'OUTPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_global_QGIS.tif', 'RESAMPLING' : 0 }

Image to image Co-Registration:

Processing file: C:\Workspace\AMAZONIA1\AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif

Perform automatic subpixel co-registration with Arosics...

(To check the complete log of the process, open the Python Console)...

Traceback (most recent call last):
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\py_tools_ds\geo\raster\conversion.py", line 120, in raster2polygon
status = gdal.Polygonize(src_band,
File "C:\OSGeo4W\apps\Python39\lib\site-packages\osgeo\gdal.py", line 3835, in Polygonize
return _gdal.Polygonize(*args, **kwargs)
RuntimeError: User terminated

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\OSGeo4W\apps\Python39\lib\shutil.py", line 616, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] O processo não pode aceder ao ficheiro porque este está a ser utilizado por outro processo: 'D:\\Temp\\tmpjlpw23tn\\polygonize_result.geojson'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\OSGeo4W\apps\Python39\lib\tempfile.py", line 801, in onerror
_os.unlink(path)
PermissionError: [WinError 32] O processo não pode aceder ao ficheiro porque este está a ser utilizado por outro processo: 'D:\\Temp\\tmpjlpw23tn\\polygonize_result.geojson'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Coregistration\automated_global_coregistration_algorithm.py", line 270, in processAlgorithm
CR = COREG(img_ref, img_tgt, path_out=output_file, align_grids=align_grids, match_gsd=match_gsd,
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 413, in __init__
self._get_image_params()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 547, in _get_image_params
self.ref = GeoArray_CoReg(self.params, 'ref')
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 120, in __init__
_ = self.footprint_poly # execute getter
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\geoarray\baseclasses.py", line 497, in footprint_poly
multipolygon = raster2polygon(self.mask_nodata.astype(np.uint8), self.gt, self.prj, exact=False,
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\py_tools_ds\geo\raster\conversion.py", line 141, in raster2polygon
gjs = json.load(f)
File "C:\OSGeo4W\apps\Python39\lib\tempfile.py", line 826, in __exit__
self.cleanup()
File "C:\OSGeo4W\apps\Python39\lib\tempfile.py", line 830, in cleanup
self._rmtree(self.name)
File "C:\OSGeo4W\apps\Python39\lib\tempfile.py", line 812, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\OSGeo4W\apps\Python39\lib\shutil.py", line 740, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\OSGeo4W\apps\Python39\lib\shutil.py", line 618, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\OSGeo4W\apps\Python39\lib\tempfile.py", line 804, in onerror
cls._rmtree(path)
File "C:\OSGeo4W\apps\Python39\lib\tempfile.py", line 812, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\OSGeo4W\apps\Python39\lib\shutil.py", line 740, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\OSGeo4W\apps\Python39\lib\shutil.py", line 599, in _rmtree_unsafe
onerror(os.scandir, path, sys.exc_info())
File "C:\OSGeo4W\apps\Python39\lib\shutil.py", line 596, in _rmtree_unsafe
with os.scandir(path) as scandir_it:
NotADirectoryError: [WinError 267] O nome do diretório é inválido: 'D:\\Temp\\tmpjlpw23tn\\polygonize_result.geojson'

Execution failed after 30.48 seconds

Loading resulting layers
Algorithm 'Automated global Co-Registration' finished

Even more strange is that now I'm getting the same error with QGIS 3.16.11:

QGIS version: 3.16.11-Hannover
QGIS code revision: 26cc1c76
Qt version: 5.15.2
GDAL version: 3.3.1
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
Processing algorithm…
Algorithm 'Automated global Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : False, 'IMG_REF' : 'C:/Workspace/AMAZONIA1/S2/L2A_T30TUK_A032166_20210819T111451_2021-08-19_con/RT_T30TUK_A032166_20210819T111451_B0stack_raster.tif', 'INPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif', 'MATCHING_WINDOW' : None, 'MATCH_GSD' : False, 'MAX_SHIFT' : 10, 'OUTPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_global_QGIS.tif', 'RESAMPLING' : 0 }

Image to image Co-Registration:

Processing file: C:\Workspace\AMAZONIA1\AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif

Perform automatic subpixel co-registration with Arosics...

(To check the complete log of the process, open the Python Console)...

Traceback (most recent call last):
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\py_tools_ds\geo\raster\conversion.py", line 120, in raster2polygon
status = gdal.Polygonize(src_band,
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\site-packages\osgeo\gdal.py", line 3824, in Polygonize
return _gdal.Polygonize(*args, **kwargs)
RuntimeError: User terminated

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\shutil.py", line 616, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 32] O processo não pode aceder ao ficheiro porque este está a ser utilizado por outro processo: 'D:\\Temp\\tmp4ov_pxem\\polygonize_result.geojson'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\tempfile.py", line 801, in onerror
_os.unlink(path)
PermissionError: [WinError 32] O processo não pode aceder ao ficheiro porque este está a ser utilizado por outro processo: 'D:\\Temp\\tmp4ov_pxem\\polygonize_result.geojson'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Coregistration\automated_global_coregistration_algorithm.py", line 270, in processAlgorithm
CR = COREG(img_ref, img_tgt, path_out=output_file, align_grids=align_grids, match_gsd=match_gsd,
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 413, in __init__
self._get_image_params()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 547, in _get_image_params
self.ref = GeoArray_CoReg(self.params, 'ref')
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 120, in __init__
_ = self.footprint_poly # execute getter
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\geoarray\baseclasses.py", line 497, in footprint_poly
multipolygon = raster2polygon(self.mask_nodata.astype(np.uint8), self.gt, self.prj, exact=False,
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\py_tools_ds\geo\raster\conversion.py", line 141, in raster2polygon
gjs = json.load(f)
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\tempfile.py", line 826, in __exit__
self.cleanup()
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\tempfile.py", line 830, in cleanup
self._rmtree(self.name)
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\tempfile.py", line 812, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\shutil.py", line 740, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\shutil.py", line 618, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\tempfile.py", line 804, in onerror
cls._rmtree(path)
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\tempfile.py", line 812, in _rmtree
_shutil.rmtree(name, onerror=onerror)
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\shutil.py", line 740, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\shutil.py", line 599, in _rmtree_unsafe
onerror(os.scandir, path, sys.exc_info())
File "C:\PROGRA~1\QGIS31~1.11\apps\Python39\lib\shutil.py", line 596, in _rmtree_unsafe
with os.scandir(path) as scandir_it:
NotADirectoryError: [WinError 267] O nome do diretório é inválido: 'D:\\Temp\\tmp4ov_pxem\\polygonize_result.geojson'

Execution failed after 30.84 seconds

Loading resulting layers
Algorithm 'Automated global Co-Registration' finished

I don't know if this is relevant, but I'm geting this Python warning when QGIS starts:

2021-11-19T11:19:12     WARNING    warning:C:\OSGeo4W/apps/qgis/./python\qgis\utils.py:888: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
              mod = _builtin_import(name, globals, locals, fromlist, level)
             
             traceback: File "", line 1, in 
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 391, in loadPlugin
              __import__(packageName)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Coregistration\__init__.py", line 24, in 
              import pkg_resources
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\pkg_resources\__init__.py", line 74, in 
              from pkg_resources.extern import appdirs
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1058, in _handle_fromlist
              File "", line 228, in _call_with_frames_removed
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 666, in _load_unlocked
              File "", line 565, in module_from_spec
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\pkg_resources\extern\__init__.py", line 52, in create_module
              return self.load_module(spec.name)
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\pkg_resources\extern\__init__.py", line 37, in load_module
              __import__(extant)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\pkg_resources\_vendor\appdirs.py", line 560, in 
              import win32com.shell
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 972, in _find_and_load_unlocked
              File "", line 228, in _call_with_frames_removed
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\win32com\__init__.py", line 6, in 
              import pythoncom
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\pythoncom.py", line 2, in 
              import pywintypes
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\win32\lib\pywintypes.py", line 2, in 
              import imp, sys, os
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\OSGeo4W\apps\Python39\lib\imp.py", line 31, in 
              warnings.warn("the imp module is deprecated in favour of importlib; "
             
             
2021-11-19T12:49:55     WARNING    warning:C:\OSGeo4W\apps\Python39\lib\site-packages\GDAL-3.4.0-py3.9-win-amd64.egg\osgeo\gdalnumeric.py:6: DeprecationWarning:
             
             instead of `import gdalnumeric`, please consider `import numpy` and/or `from osgeo import gdal_array`
             
             
             traceback: File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Coregistration\automated_global_coregistration_algorithm.py", line 219, in processAlgorithm
              from arosics import COREG
              File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 32, in __wrapping_ee_import__
              _module_ = __builtin_import__(name, *args, **kwargs)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\__init__.py", line 31, in 
              from arosics.CoReg import COREG
              File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 32, in __wrapping_ee_import__
              _module_ = __builtin_import__(name, *args, **kwargs)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 43, in 
              from .DeShifter import DESHIFTER, _dict_rspAlg_rsp_Int
              File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 32, in __wrapping_ee_import__
              _module_ = __builtin_import__(name, *args, **kwargs)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\DeShifter.py", line 33, in 
              from geoarray import GeoArray
              File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 32, in __wrapping_ee_import__
              _module_ = __builtin_import__(name, *args, **kwargs)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\geoarray\__init__.py", line 30, in 
              from .baseclasses import GeoArray # noqa: E402
              File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 32, in __wrapping_ee_import__
              _module_ = __builtin_import__(name, *args, **kwargs)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\geoarray\baseclasses.py", line 35, in 
              from osgeo import gdal, gdal_array, gdalnumeric
              File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 32, in __wrapping_ee_import__
              _module_ = __builtin_import__(name, *args, **kwargs)
              File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
              mod = _builtin_import(name, globals, locals, fromlist, level)
              File "", line 1058, in _handle_fromlist
              File "", line 228, in _call_with_frames_removed
              File "", line 1007, in _find_and_load
              File "", line 986, in _find_and_load_unlocked
              File "", line 680, in _load_unlocked
              File "", line 855, in exec_module
              File "", line 228, in _call_with_frames_removed
              File "C:\OSGeo4W\apps\Python39\lib\site-packages\GDAL-3.4.0-py3.9-win-amd64.egg\osgeo\gdalnumeric.py", line 6, in 
              warn('instead of `import gdalnumeric`, please consider `import numpy` and/or `from osgeo import gdal_array`',

Does these errors make sense to you?

Thank you very much @XavierCLL !!

@danschef
Copy link

danschef commented Nov 19, 2021

Hi @XavierCLL and @PedroVenancio,

pretty cool to see how this gets to life! I also had a short look but not much time for testing so far. However, as the developer of AROSICS, I would offer to test it and give you some feedback in the next time. I would really like to see this working!

@PedroVenancio:
Could you check which version of py_tools_ds is installed on both setups. I guess that the error you are getting in case of QGIS 3.22.0 is somehow related with a recent update of py_tools_ds which seems to cause issues on Windows (I only tested it on Linux so far). Feel free to open issues for that here.

The Python warning is not related to AROSICS - looks like QGIS is importing deprecated GDAL modules there.

@PedroVenancio
Copy link
Author

Hi @danschef

I'm glad to see you looking at this! It's really great! It will open the use of AROSICS to a broad group of potential users!

I think you are absolutely right, I was with py_tools_ds 0.19.0. Downgrading to 0.18.1, arosics global already works!

Running local, I get this error, because it is expecting something that does not exist in version 0.18.1:

QGIS version: 3.16.11-Hannover
QGIS code revision: 26cc1c76
Qt version: 5.15.2
GDAL version: 3.3.1
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
Processing algorithm…
Algorithm 'Automated local Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : False, 'GRID_RES' : 200, 'IMG_REF' : 'C:/Workspace/AMAZONIA1/S2/L2A_T30TUK_A032166_20210819T111451_2021-08-19_con/RT_T30TUK_A032166_20210819T111451_B0stack_raster.tif', 'INPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif', 'MATCH_GSD' : False, 'MAX_SHIFT' : 10, 'OUTPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_local_QGIS_3.tif', 'RESAMPLING' : 0, 'WINDOW_SIZE' : 64 }

Image to image Co-Registration:

Processing file: C:\Workspace\AMAZONIA1\AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif

Perform automatic subpixel co-registration with Arosics...

(To check the complete log of the process, open the Python Console)...

Warning: in Windows due to restrictions to enable multiprocessing inside Qgis, the process could take longer. Continue with one core ...

Traceback (most recent call last):
File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Coregistration\automated_local_coregistration_algorithm.py", line 278, in processAlgorithm
CRL.correct_shifts()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg_local.py", line 810, in correct_shifts
self.calculate_spatial_shifts()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg_local.py", line 480, in calculate_spatial_shifts
self._tiepoint_grid.get_CoRegPoints_table()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\Tie_Point_Grid.py", line 419, in get_CoRegPoints_table
bar.print_progress((i + 1) / len(GDF) * 100)
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\py_tools_ds\processing\progress_mon.py", line 124, in print_progress
self.out.write('\r')
AttributeError: 'NoneType' object has no attribute 'write'

Execution failed after 23.99 seconds

Loading resulting layers
Algorithm 'Automated local Co-Registration' finished

I think the issue with gdal_polygonize can be related with the callback, as reported here:
https://gis.stackexchange.com/questions/194886/gdal-polygonize-returns-with-a-strange-error

Meanwhile I've updated QGIS 3.22.0 to the latest version, and it seems that something had changed and some Python package is missing. GDAL, GEOS and PROJ had been updated, I don't know if it could be something related to that:

QGIS version: 3.22.0-Białowieża
QGIS code revision: d9022691f1
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.4.0
GEOS version: 3.10.0-CAPI-1.16.0
PROJ version: Rel. 8.2.0, November 1st, 2021
PDAL version: 2.3.0 (git-version: 9f35b7)
Algorithm started at: 2021-11-19T14:48:42
Algorithm 'Automated global Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : False, 'IMG_REF' : 'C:/Workspace/AMAZONIA1/S2/L2A_T30TUK_A032166_20210819T111451_2021-08-19_con/RT_T30TUK_A032166_20210819T111451_B0stack_raster.tif', 'INPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif', 'MATCHING_WINDOW' : None, 'MATCH_GSD' : False, 'MAX_SHIFT' : 10, 'OUTPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_global_QGIS_4.tif', 'RESAMPLING' : 0 }


Error loading Arosics, this plugin requires additional Python packages to work. Read the install instructions here:

https://github.com/SMByC/Coregistration-Qgis-processing#installation


Execution completed in 0.76 seconds
Results:
{}

Loading resulting layers
Algorithm 'Automated global Co-Registration' finished

@XavierCLL
Copy link
Member

Hi @PedroVenancio and @danschef nice to see you here and thanks both of you and your tests, any feedback is welcome to improve the plugin!

@PedroVenancio open the Python Console in Qgis and run:

import arosics

Copy the error here to check what is happening, thanks

Xavier

@PedroVenancio
Copy link
Author

Hi @XavierCLL

Copy the error here to check what is happening, thanks

Here is the output of QGIS 3.22.0:

import arosics
Traceback (most recent call last):
  File "C:\OSGeo4W\apps\Python39\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\__init__.py", line 31, in <module>
    from arosics.CoReg import COREG
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 44, in <module>
    from . import geometry as GEO
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\geometry.py", line 33, in <module>
    from geopandas import GeoDataFrame
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\geopandas\__init__.py", line 7, in <module>
    from geopandas.io.file import _read_file as read_file  # noqa
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\geopandas\io\file.py", line 7, in <module>
    import fiona
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\fiona\__init__.py", line 86, in <module>
    from fiona.collection import BytesCollection, Collection
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGeo4W\apps\Python39\lib\site-packages\fiona\collection.py", line 11, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
  File "C:\OSGeo4W/apps/qgis/./python\qgis\utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed while importing ogrext: Impossível localizar o módulo especificado.

@danschef
Copy link

@PedroVenancio:

The issue with gdal_polygonize causing the PermissionError on Windows (#1 (comment)) should be fixed in py_tools_ds 0.19.1 which is already available on PyPI and will be released in the next hours on conda-forge.

Regarding the installation of your environment: I can only recommend to use conda and install QGIS and AROSICS into the same environment: conda create -n coreg -c conda-forge qgis arosics. Using Mambaforge makes it really fast.

I just tested it with global and local co-registration and it works quite well.

@PedroVenancio
Copy link
Author

Thanks @danschef

I've already tested py_tools_ds 0.19.1 with QGIS 3.16 and it works! However, I'm still getting this issue with arosics local

QGIS version: 3.16.11-Hannover
QGIS code revision: 26cc1c76
Qt version: 5.15.2
GDAL version: 3.3.1
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
Processing algorithm…
Algorithm 'Automated local Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : False, 'GRID_RES' : 200, 'IMG_REF' : 'C:/Workspace/AMAZONIA1/S2/L2A_T30TUK_A032166_20210819T111451_2021-08-19_con/RT_T30TUK_A032166_20210819T111451_B0stack_raster.tif', 'INPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif', 'MATCH_GSD' : False, 'MAX_SHIFT' : 10, 'OUTPUT' : 'C:/Workspace/AMAZONIA1/AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2_AROSICS_RT_T30TUK_A032166_20210819T111451_B0stack_raster_Navalacruz_local_QGIS_3.tif', 'RESAMPLING' : 0, 'WINDOW_SIZE' : 64 }

Image to image Co-Registration:

Processing file: C:\Workspace\AMAZONIA1\AMAZONIA_1_WFI_20210817_029_009_L4_BAND1234_Clip_S2.tif

Perform automatic subpixel co-registration with Arosics...

(To check the complete log of the process, open the Python Console)...

Warning: in Windows due to restrictions to enable multiprocessing inside Qgis, the process could take longer. Continue with one core ...

Traceback (most recent call last):
File "C:\Users/PedroVenancio/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Coregistration\automated_local_coregistration_algorithm.py", line 278, in processAlgorithm
CRL.correct_shifts()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg_local.py", line 810, in correct_shifts
self.calculate_spatial_shifts()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg_local.py", line 480, in calculate_spatial_shifts
self._tiepoint_grid.get_CoRegPoints_table()
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\Tie_Point_Grid.py", line 419, in get_CoRegPoints_table
bar.print_progress((i + 1) / len(GDF) * 100)
File "C:\Users\PedroVenancio\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\py_tools_ds\processing\progress_mon.py", line 124, in print_progress
self.out.write('\r')
AttributeError: 'NoneType' object has no attribute 'write'

Execution failed after 23.99 seconds

Loading resulting layers
Algorithm 'Automated local Co-Registration' finished

but it works in another attempts. I didn't found the pattern yet.

Meanwhile I tried it in conda conda create -n coreg -c conda-forge qgis arosics and there it works great, with QGIS 3.18.3!

QGIS 3.22 from OSGeo4W v2 is still failing.

@danschef
Copy link

This AttributeError is caused by sys.stderr which is None for some reason on your machine. @XavierCLL, could this be the a consequence of calling AROSICS within QGIS? So far, I cannot reproduce it here.

@danschef
Copy link

https://docs.python.org/3/library/sys.html#sys.__stdout
Under some conditions stdin, stdout and stderr as well as the original values stdin, stdout and stderr can be None. It is usually the case for Windows GUI apps that aren’t connected to a console and Python apps started with pythonw.

Looks like the answer is yes. I will see how I can fix this.

@XavierCLL
Copy link
Member

XavierCLL commented Nov 21, 2021

This AttributeError is caused by sys.stderr which is None for some reason on your machine. @XavierCLL, could this be the a consequence of calling AROSICS within QGIS? So far, I cannot reproduce it here.

I cannot reproduce that issue as well, but maybe because I've tested in an old VM Windows version. My primary OS, Linux, the plugin works like a charm (with parallelization for the local algorithm).

I understand that the best option is using Conda to install Arosics and all of its depends, but most of the users (mostly windows users) is hard to say that to install a plugin it requires installing another software and running some commands in a terminal, and others steps. That is the reason that I'm trying to have a special zip with all dependencies inside for windows users to install it in the Qgis version installed in the system. I've updated the zip with the latest changes and with the latest version of py_tools_ds, could @PedroVenancio please test it? https://bit.ly/3FwGWS2 (maybe the last issue about stdout is still present)

Thanks guys!

@danschef
Copy link

@PedroVenancio
The AttributeError: 'NoneType' object has no attribute 'write' from #1 (comment) should now be fixed in py_tools_ds 0.20.0.

@dpoursanidis
Copy link

Hello team!

Trying to use it for first time, using two PRISMA imagery i have the following.


QGIS version: 3.22.1-Białowieża
QGIS code revision: 663dcf8fb9
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.4.0
GEOS version: 3.10.0-CAPI-1.16.0
PROJ version: Rel. 8.2.0, November 1st, 2021
PDAL version: 2.3.0 (git-version: 9f35b7)
Algorithm started at: 2022-02-10T15:08:51
Algorithm 'Automated global Co-Registration' starting…
Input parameters:
{ 'ALIGN_GRIDS' : True, 'IMG_REF' : 'F:/CoregistrationAROCIS/1/Cube.tif', 'INPUT' : 'F:/CoregistrationAROCIS/2/Cube.tif', 'MATCHING_WINDOW_CENTER' : None, 'MATCHING_WINDOW_SIZE' : 256, 'MATCH_GSD' : True, 'MAX_SHIFT' : 5, 'OUTPUT' : 'TEMPORARY_OUTPUT', 'RESAMPLING' : 0 }

Image to image Co-Registration:

Processing file: F:\CoregistrationAROCIS\2\Cube.tif

Perform automatic subpixel co-registration with Arosics...

(To check the complete log of the process, open the Python Console)...

Traceback (most recent call last):
File "C:\Users/DimitrisPoursanidis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Coregistration\automated_global_coregistration_algorithm.py", line 281, in processAlgorithm
CR.correct_shifts()
File "C:\Users\DimitrisPoursanidis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\CoReg.py", line 1723, in correct_shifts
self.deshift_results = DS.correct_shifts()
File "C:\Users\DimitrisPoursanidis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\arosics\DeShifter.py", line 383, in correct_shifts
warp_ndarray(in_arr, self.shift_gt, self.shift_prj, self.ref_prj,
File "C:\Users\DimitrisPoursanidis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\Coregistration\extlibs_windows\py_tools_ds\geo\raster\reproject.py", line 456, in warp_ndarray
res_ds = gdal.Warp(
File "C:\PROGRA~1\QGIS32~1.1\apps\Python39\lib\site-packages\GDAL-3.4.0-py3.9-win-amd64.egg\osgeo\gdal.py", line 673, in Warp
return wrapper_GDALWarpDestName(destNameOrDestDS, srcDSTab, opts, callback, callback_data)
File "C:\PROGRA~1\QGIS32~1.1\apps\Python39\lib\site-packages\GDAL-3.4.0-py3.9-win-amd64.egg\osgeo\gdal.py", line 4211, in wrapper_GDALWarpDestName
return _gdal.wrapper_GDALWarpDestName(*args)
RuntimeError: User terminated

Execution failed after 4.08 seconds

Loading resulting layers
Algorithm 'Automated global Co-Registration' finished

Any clue what is going on?

@danschef
Copy link

Probably a memory issue. Could you have a look at your memory ressources when running this code? Warped PRISMA data can get quite large and it seems like you are using an in-memory output. Anyways, I don´t think this exception is related to the topic of the above issue. So you should open a separate one. I am also not sure if it is related to the code of the QGIS plugin itself or the underlying arosics package (which has a separate issue tracker).

@XavierCLL
Copy link
Member

Hi @dpoursanidis, welcome!

Thanks @danschef, yes it seems more about ram-memory or Arosics issue, but you can also test the plugin using the all-in-one zip to rule out a dependency issue: https://github.com/SMByC/Coregistration-Qgis-processing#windows

@dpoursanidis
Copy link

Thanks @XavierCLL for the instructions. I have install it using the zip file. In the zip, at the help file there is a note "This plugin requires additional Python packages (Arosics and its depends), that are generally not part of QGIS's Python. For Windows users download and reinstall the plugin with all the libs inside from here" That link does not work. I will see @danschef the issue tracker to continue the quest. Thanks for your great work!

@XavierCLL
Copy link
Member

Weird, it should not happen, that is the idea with that package include all libs inside, are you using a 64bits Windows?

@dpoursanidis
Copy link

I use 64bit windows, yes.
The problem is that the url to download the suggested has that
image

@XavierCLL
Copy link
Member

XavierCLL commented Feb 10, 2022

@dpoursanidis
Copy link

Thanks for that. In that zip file, in the help, they have another link. Have you test it?

@XavierCLL
Copy link
Member

You're right, that link expired, fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants