GFZ / arosics

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

Multi-polygon footprint: tie-points are computed, but image gets cut #35

Closed remote-gianni closed 6 months ago

remote-gianni commented 6 months ago

Description

I'm using AROSICS to perform local co-registration for several airborne flightlines. For images with lines of missing data, not the entire flightlines get co-registered.

Unlike issue #23, the tie-points are actually computed, but the returned result gets cropped.

Is there a way to avoid AROSICS using py_tools_ds' fill_holes_within_poly() cropping the output?

What I Did

The image footprint: footprint

The concave hull passed to AROSICS: footprint_passed

The computed tie-points (graduated by absolute shift): tie_points

The returned result (darkened): result

The warning message:

...miniconda3\envs\arosics\Lib\site-packages\py_tools_ds\geo\vector\topology.py:199: RuntimeWarning: The given MultiPolygon contains 1 disjunct polygon(s) outside of the largest polygon. fill_holes_within_poly() will only return the largest polygon as a filled version.
danschef commented 6 months ago

Hi! Could you provide some more information how you called AROSICS and which step exactly crops your result? Is it the call of the COREG_LOCAL.correct_shifts method that crops it?

remote-gianni commented 6 months ago

Hi Daniel

Thanks for your quick reply.

Yes, I'm using COREG_LOCAL. Pointing out the correct_shifts() method already resolved my "issue"; the 'cliptoextent' argument was set to True in my code as attached below. Setting it back to its actual default value results in AROSICS shifting the entire image as expected.

Thanks a lot!

from arosics import COREG_LOCAL

# avoid error messages if reference does not cover entire image
import numpy as np
np.seterr(divide="ignore", invalid="ignore") 

reference = some image
reference_footprint = some concave hull
target = some other image
target_footprint = some other concave hull
out_path = some output path for the co-registered image
out_points = some output path for the tie-point grid

kwargs = {
    "grid_res": 50, 
    "window_size": (64, 64),
    "path_out": out_path,
    "fmt_out": "ENVI",
    "out_crea_options": None,
    "q": False,
    "nodata": (0, 0),
    "calc_corners": False,
    "ignore_errors": True,
    "footprint_poly_ref": reference_footprint,
    "footprint_poly_tgt": target_footprint,
    "max_shift": 5,
    "tieP_filter_level": 2,
}

CRL = COREG_LOCAL(reference, target, **kwargs)
CRL.correct_shifts(cliptoextent=True) 

CRL.CoRegPoints_table.to_csv(out_points, index=False)