Skip to content

Matching window in target image is larger than overlap area but further shrinking the matching window is not possible. #56

@fucongju

Description

@fucongju
  • arosics version: 1.12.0
  • Python version: 3.10.15
  • Operating System: Linux, Ubuntu

Description

There is an offset in the geometric coordinates of the PRISMA satellite and I am trying to correct it using Sentinel-2 as a reference image. Then an error occurred regarding the input parameters:

(GR) congju@congjufu:~/georeferencing$ python AutomaticGeographicRegistration.py
/home/congju/anaconda3/envs/GR/lib/python3.10/site-packages/scipy/__init__.py:146: UserWarning: A NumPy version >=1.17.3 and <1.25.0 is required for this version of SciPy (detected version 1.26.4
  warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
Processing tif files:   0%|                                                                       | 0/1 [00:00<?, ?it/s]Processing file #1: /home/congju/georeferencing/PRISMA/20230524101720.tif
Bounds of target TIFF file: BoundingBox(left=12.029533386230469, bottom=45.29204559326172, right=12.502799034118652, top=45.62303924560547)
Bounds of reference file /home/congju/georeferencing/standard/S2_b4_WGS84.tif: BoundingBox(left=11.538706894083058, bottom=44.99756712645166, right=12.999299064947925, top=46.024365385438045)
Reference file for /home/congju/georeferencing/PRISMA/20230524101720.tif is /home/congju/georeferencing/standard/S2_b4_WGS84.tif
Automatically detected nodata value for GeoArray_CoReg 'IN_MEM': 0.0
Calculating footprint polygon and actual data corner coordinates for reference image...
Polygonize progress     |==================================================| 100.0% Complete  => 0:00:00
Bounding box of calculated footprint for reference image:
        (11.538706894083058, 44.99756712645166, 12.999238484236837, 46.024365385438045)
Automatically detected nodata value for GeoArray_CoReg 'IN_MEM': nan
Calculating footprint polygon and actual data corner coordinates for image to be shifted...
Polygonize progress     |==================================================| 100.0% Complete  => 0:00:00
/home/congju/anaconda3/envs/GR/lib/python3.10/site-packages/arosics/CoReg.py:124: UserWarning: The footprint of the image to be shifted contains multiple separate image parts. AROSICS will only process the largest image part.
  warnings.warn('The footprint of the %s contains multiple separate image parts. '
Bounding box of calculated footprint for image to be shifted:
        (12.192810034751892, 45.29204559326172, 12.502799034118652, 45.62303924560547)
Matching window position (X,Y): 12.392802429719932/45.41217173577678
/home/congju/georeferencing/AutomaticGeographicRegistration.py:118: UserWarning:
First attempt to check the functionality of co-registration failed. Check your input data and parameters. The following error occurred:
  auto_adjust_local_coreg(geoArr_reference, geoArr_target, outputfile)
**Failed to coregister /home/congju/georeferencing/PRISMA/20230524101720.tif due to Matching window in target image is larger than overlap area but further shrinking the matching window is not possible.** Check if the footprints of the input data have been computed correctly.
Processing tif files: 100%|███████████████████████████████████████████████████████████████| 1/1 [00:05<00:00,  5.53s/it]

Please should I change any parameters?

What I Did

def auto_adjust_local_coreg(geoArr_reference, geoArr_target, outputfile, initial_grid_res=900, initial_max_shift=900):
        grid_res = initial_grid_res
        max_shift = initial_max_shift
        while True:
            try:
                CR_LOCAL = COREG_LOCAL(
                    geoArr_reference,
                    geoArr_target,
                    grid_res=grid_res,
                    max_shift=max_shift,
                    path_out=outputfile,
                    CPUs=2
                )
                CR_LOCAL.calculate_spatial_shifts()
                CR_LOCAL.correct_shifts()
                break  # if no errors, break the loop
            except RuntimeError as e:
                if 'No match found in the given window' in str(e):
                    # adjust parameters and try again
                    grid_res += 40
                    max_shift += 50
                else:
                    raise e

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions