miop.reconstruction

Classes

Reconstruction([by_pair])

Reconstructs 3D point clouds from matched 2D image points using camera intrinsics and extrinsics.

class miop.reconstruction.Reconstruction(by_pair=False)[source]

Bases: DAGNode

Reconstructs 3D point clouds from matched 2D image points using camera intrinsics and extrinsics.

pcds

A nested list of reconstructed point clouds. - Outer list corresponds to each face. - Inner list contains one point cloud per image pair.

Type:

list of list of np.ndarray or None

by_pair

Determines the format of input matches. If True, matches are expected as pairs.

Type:

bool

compute_point_cloud(camera_position, dense_matches)[source]

Computes 3D point clouds via affine triangulation from dense 2D matches.

Parameters:
  • camera_position (list of dict) – List of camera parameters for each face.

  • dense_matches (list) – List of matched 2D point arrays. Format depends on by_pair.

Returns:

Nested list of point clouds. One list per face, one cloud per image pair.

Return type:

list of list of np.ndarray

eval(camera_position, matches)[source]

Computes the 3D point cloud for each image pair using triangulation.

Parameters:
  • camera_position (list of dict) –

    A list of dictionaries containing camera rotation matrices and intrinsics. Each dictionary represents one face and must contain:

    • ’rotations’: np.ndarray of shape (N, 3, 3)

    • ’intrinsics’: list with two elements:

      • intrinsics[0]: list of scale factors (k1, k2, …)

      • intrinsics[1]: list containing [c, s] values (affine scale & shear)

  • matches (list) – 2D point matches between images. Format depends on by_pair.

Returns:

Reconstructed 3D point clouds per face and image pair.

Return type:

list of list of np.ndarray

inhom_triangulation(b, A)[source]

Solves an inhomogeneous linear system Ax = b using the Moore-Penrose pseudo-inverse.

Parameters:
  • b (np.ndarray) – Right-hand side matrix (stacked 2D correspondences).

  • A (np.ndarray) – Projection matrix (camera model matrix).

Returns:

Triangulated 3D point cloud of shape (N, 3).

Return type:

np.ndarray

save(path)[source]

Saves the reconstructed 3D point clouds to a .npy file.

Parameters:

path (str) – Path to save the numpy file. Must end with .npy.

Raises:

ValueError – If path does not end in .npy or if no point clouds exist.

show(face=0)[source]

Displays the reconstructed point cloud for a given face using Open3D.

Parameters:

face (int, optional) – Index of the face to display (default: 0).