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

Add ICP in Python #581

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
53c34f3
Incremental commit on affine reorg
rhugonnet May 24, 2024
ea0d71c
Merge remote-tracking branch 'upstream/main' into reorg_affine
rhugonnet Jun 7, 2024
77eabe1
Incremental commit to reorg
rhugonnet Jun 10, 2024
11449c1
Fix resolution error
rhugonnet Aug 6, 2024
f2c5952
Merge remote-tracking branch 'upstream/main' into reorg_affine
rhugonnet Aug 6, 2024
d23e3f1
Finalize same CRS reprojection based on SciPy, add test with GDAL rep…
rhugonnet Aug 6, 2024
0a4cca4
Add further comments on tests
rhugonnet Aug 6, 2024
7272267
Incremental commit to new affine coregs
rhugonnet Aug 23, 2024
4c1944f
Finalize new structure
rhugonnet Aug 24, 2024
530eaf5
Linting but not all mypy
rhugonnet Aug 24, 2024
fad5e89
Linting
rhugonnet Aug 27, 2024
be3bd68
Finalize tests and linting
rhugonnet Aug 28, 2024
c907bbd
Implement new coreg nested dictionary structure
rhugonnet Aug 29, 2024
ba0a7e3
Linting and corrections
rhugonnet Aug 29, 2024
f575f3f
Last adjustments
rhugonnet Aug 30, 2024
e878f9c
Linting
rhugonnet Aug 30, 2024
d082779
Last test fixes
rhugonnet Aug 30, 2024
9463fe9
Start ICP structure
rhugonnet Aug 31, 2024
828f489
Merge branch 'reorg_affine' into replace_icp_python
rhugonnet Aug 31, 2024
eb2e92f
Continue ICP implementation
rhugonnet Sep 3, 2024
998e4ed
Merge remote-tracking branch 'upstream/main' into replace_icp_python
rhugonnet Sep 5, 2024
aad7437
Finish merging properly...
rhugonnet Sep 5, 2024
e3da198
Merge remote-tracking branch 'upstream/main' into replace_icp_python
rhugonnet Sep 19, 2024
13d87a2
Merge remote-tracking branch 'upstream/main' into replace_icp_python
rhugonnet Nov 9, 2024
16553eb
Incremental commit on ICP
rhugonnet Nov 11, 2024
f96dce2
Incremental commit on Python ICP
rhugonnet Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,5 @@ dependencies:
# Optional dependency
- -e ./

# "Headless" needed for opencv to install without requiring system dependencies
- opencv-contrib-python-headless

# To run CI against latest GeoUtils
# - git+https://github.com/rhugonnet/geoutils.git
2 changes: 0 additions & 2 deletions doc/source/coregistration.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ plt.tight_layout()
Iterative Closest Point (ICP) coregistration is an iterative point cloud registration method from [Besl and McKay (1992)](https://doi.org/10.1117/12.57955). It aims at iteratively minimizing the distance between closest neighbours by applying sequential rigid transformations. If DEMs are used as inputs, they are converted to point clouds.
As for Nuth and Kääb (2011), the iteration stops if it reaches the maximum number of iteration limit or if the iterative transformation amplitude falls below a specified tolerance.

ICP is currently based on [OpenCV's implementation](https://docs.opencv.org/4.x/dc/d9b/classcv_1_1ppf__match__3d_1_1ICP.html) (an optional dependency), which includes outlier removal arguments. This may improve results significantly on outlier-prone data, but care should still be taken, as the risk of landing in [local minima](https://en.wikipedia.org/wiki/Maxima_and_minima) increases.

```{code-cell} ipython3
:tags: [hide-cell]
:mystnb:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ testpaths = [
"tests",
"xdem"
]
log_cli = "True"
log_cli_level = "INFO"

2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ include =

[options.extras_require]
opt =
opencv
openh264
pytransform3d
noisyopt
test =
Expand Down
6 changes: 3 additions & 3 deletions tests/test_coreg/test_affine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

import warnings
import logging

import geopandas as gpd
import geoutils
Expand All @@ -18,7 +19,6 @@
from xdem import coreg, examples
from xdem.coreg.affine import AffineCoreg, _reproject_horizontal_shift_samecrs


def load_examples(crop: bool = True) -> tuple[RasterType, RasterType, Vector]:
"""Load example files to try coregistration methods with."""

Expand Down Expand Up @@ -199,8 +199,8 @@ def test_raise_all_nans(self) -> None:
pytest.raises(ValueError, icp.fit, dem1, dem2, transform=affine)

@pytest.mark.parametrize("fit_args", all_fit_args) # type: ignore
@pytest.mark.parametrize("shifts", [(20, 5, 2), (-50, 100, 2)]) # type: ignore
@pytest.mark.parametrize("coreg_method", [coreg.NuthKaab, coreg.DhMinimize, coreg.ICP]) # type: ignore
@pytest.mark.parametrize("shifts", [(-1000, 2000, 200)]) # type: ignore
@pytest.mark.parametrize("coreg_method", [coreg.ICP]) # type: ignore
def test_coreg_translations__synthetic(self, fit_args, shifts, coreg_method) -> None:
"""
Test the horizontal/vertical shift coregistrations with synthetic shifted data. These tests include NuthKaab,
Expand Down
Loading
Loading