Skip to content

Commit

Permalink
Incremental commit on Python ICP
Browse files Browse the repository at this point in the history
  • Loading branch information
rhugonnet committed Nov 13, 2024
1 parent 16553eb commit f96dce2
Show file tree
Hide file tree
Showing 7 changed files with 359 additions and 340 deletions.
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

0 comments on commit f96dce2

Please sign in to comment.