Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fix(geometry): stop homography.py leaking its imports into kornia.geometry (#4994)

RitiGrover2f48e46e37b5
diff --git a/changelog.d/4994.breaking.md b/changelog.d/4994.breaking.md
new file mode 100644
index 000000000..0e0d1175e
--- /dev/null
+++ b/changelog.d/4994.breaking.md
@@ -0,0 +1,5 @@
+`kornia.geometry.homography` now defines `__all__` with its eight public functions, so its imports are no longer
+star-imported into `kornia.geometry`: `torch`, `warnings`, `typing.Optional`, `typing.Tuple`, the type alias
+`TupleTensor`, `KORNIA_CHECK_SHAPE`, `safe_inverse_with_mask` and `safe_solve_with_mask`. None of them is documented
+on `kornia.geometry`, and per `docs/source/get-started/stability.rst` undocumented helpers are private. They are
+dropped from `tests/api_surface.json` in this change. (#4994)
diff --git a/kornia/geometry/homography.py b/kornia/geometry/homography.py
index df32e9ace..c8ea45454 100644
--- a/kornia/geometry/homography.py
+++ b/kornia/geometry/homography.py
@@ -26,6 +26,17 @@ from kornia.geometry.conversions import convert_points_from_homogeneous, convert
from kornia.geometry.epipolar import normalize_points, normalize_transformation
from kornia.geometry.linalg import transform_points
+__all__ = [
+ "find_homography_dlt",
+ "find_homography_dlt_iterated",
+ "find_homography_lines_dlt",
+ "find_homography_lines_dlt_iterated",
+ "line_segment_transfer_error_one_way",
+ "oneway_transfer_error",
+ "sample_is_valid_for_homography",
+ "symmetric_transfer_error",
+]
+
TupleTensor = Tuple[torch.Tensor, torch.Tensor]
diff --git a/tests/api_surface.json b/tests/api_surface.json
index 92fbea934..fbbe9f3e0 100644
--- a/tests/api_surface.json
+++ b/tests/api_surface.json
@@ -335,12 +335,10 @@
"Hyperplane",
"ImageRegistrator",
"IterativeQuadInterp3d",
- "KORNIA_CHECK_SHAPE",
"KRt_from_projection",
"NamedPose",
"NonMaximaSuppression2d",
"NonMaximaSuppression3d",
- "Optional",
"ParametrizedLine",
"PinholeCamera",
"PyrDown",
@@ -363,8 +361,6 @@
"SpatialSoftArgmax2d",
"StereoCamera",
"Translate",
- "Tuple",
- "TupleTensor",
"Vflip",
"affine",
"affine3d",
@@ -555,8 +551,6 @@
"rotation_matrix_to_angle_axis",
"rotation_matrix_to_axis_angle",
"rotation_matrix_to_quaternion",
- "safe_inverse_with_mask",
- "safe_solve_with_mask",
"sample_is_valid_for_homography",
"sampson_epipolar_distance",
"save_pointcloud_ply",
@@ -578,7 +572,6 @@
"symmetrical_epipolar_distance",
"thin_plate_spline",
"tilt_projection",
- "torch",
"transform",
"transform_bbox",
"transform_points",
@@ -597,7 +590,6 @@
"vector",
"vector_to_skew_symmetric_matrix",
"vflip",
- "warnings",
"warp_affine",
"warp_affine3d",
"warp_frame_depth",