pycolmap

class pycolmap.Device

Members:

auto

cpu

cuda

auto = <Device.auto: -1>
cpu = <Device.cpu: 0>
cuda = <Device.cuda: 1>
property name
property value
class pycolmap.logging
ERROR = <Level.ERROR: 2>
FATAL = <Level.FATAL: 3>
INFO = <Level.INFO: 0>
class Level

Members:

INFO

WARNING

ERROR

FATAL

ERROR = <Level.ERROR: 2>
FATAL = <Level.FATAL: 3>
INFO = <Level.INFO: 0>
WARNING = <Level.WARNING: 1>
property name
property value
WARNING = <Level.WARNING: 1>
alsologtostderr = True
static error(message: str) None
static fatal(message: str) None
static info(message: str) None
log_dir = ''
logtostderr = False
minloglevel = 0
static set_log_destination(level: pycolmap.logging.Level, path: str) None
stderrthreshold = 2
static verbose(level: int, message: str) None
verbose_level = 0
static warning(message: str) None
class pycolmap.Timer
elapsed_hours(self: pycolmap.Timer) float
elapsed_micro_seconds(self: pycolmap.Timer) float
elapsed_minutes(self: pycolmap.Timer) float
elapsed_seconds(self: pycolmap.Timer) float
pause(self: pycolmap.Timer) None
print_hours(self: pycolmap.Timer) None
print_minutes(self: pycolmap.Timer) None
print_seconds(self: pycolmap.Timer) None
reset(self: pycolmap.Timer) None
restart(self: pycolmap.Timer) None
resume(self: pycolmap.Timer) None
start(self: pycolmap.Timer) None
pycolmap.homography_decomposition(
H: numpy.ndarray[numpy.float64[3, 3]],
K1: numpy.ndarray[numpy.float64[3, 3]],
K2: numpy.ndarray[numpy.float64[3, 3]],
points1: numpy.ndarray[numpy.float64[m, 2]],
points2: numpy.ndarray[numpy.float64[m, 2]],
) dict

Analytical Homography Decomposition.

class pycolmap.Rotation3d
angle(self: pycolmap.Rotation3d) float
angle_to(self: pycolmap.Rotation3d, other: pycolmap.Rotation3d) float
inverse(self: pycolmap.Rotation3d) pycolmap.Rotation3d
matrix(self: pycolmap.Rotation3d) numpy.ndarray[numpy.float64[3, 3]]
mergedict(self: object, arg0: dict) None
norm(self: pycolmap.Rotation3d) float
normalize(self: pycolmap.Rotation3d) None
property quat

Quaternion in [x,y,z,w] format. (ndarray, default: [0. 0. 0. 1.])

summary(self: pycolmap.Rotation3d, write_type: bool = False) str
todict(self: pycolmap.Rotation3d, recursive: bool = True) dict
class pycolmap.Rigid3d
adjoint(self: pycolmap.Rigid3d) numpy.ndarray[numpy.float64[6, 6]]
essential_matrix(self: pycolmap.Rigid3d) numpy.ndarray[numpy.float64[3, 3]]
get_covariance_for_inverse(
self: pycolmap.Rigid3d,
covar: numpy.ndarray[numpy.float64[6, 6]],
) numpy.ndarray[numpy.float64[6, 6]]
static interpolate(cam_from_world1: pycolmap.Rigid3d, cam_from_world2: pycolmap.Rigid3d, t: float) pycolmap.Rigid3d
inverse(self: pycolmap.Rigid3d) pycolmap.Rigid3d
matrix(self: pycolmap.Rigid3d) numpy.ndarray[numpy.float64[3, 4]]
mergedict(self: object, arg0: dict) None
property rotation

(Rotation3d, default: Rotation3d(quat_xyzw=[0, 0, 0, 1]))

summary(self: pycolmap.Rigid3d, write_type: bool = False) str
todict(self: pycolmap.Rigid3d, recursive: bool = True) dict
property translation

(ndarray, default: [0. 0. 0.])

class pycolmap.Sim3d
inverse(self: pycolmap.Sim3d) pycolmap.Sim3d
matrix(self: pycolmap.Sim3d) numpy.ndarray[numpy.float64[3, 4]]
mergedict(self: object, arg0: dict) None
property rotation

(Rotation3d, default: Rotation3d(quat_xyzw=[0, 0, 0, 1]))

property scale

(ndarray, default: 1.0)

summary(self: pycolmap.Sim3d, write_type: bool = False) str
todict(self: pycolmap.Sim3d, recursive: bool = True) dict
transform_camera_world(self: pycolmap.Sim3d, cam_from_world: pycolmap.Rigid3d) pycolmap.Rigid3d
property translation

(ndarray, default: [0. 0. 0.])

class pycolmap.PosePriorCoordinateSystem

Members:

UNDEFINED

WGS84

CARTESIAN

CARTESIAN = <PosePriorCoordinateSystem.CARTESIAN: 1>
UNDEFINED = <PosePriorCoordinateSystem.UNDEFINED: -1>
WGS84 = <PosePriorCoordinateSystem.WGS84: 0>
property name
property value
class pycolmap.PosePrior
property coordinate_system

(PosePriorCoordinateSystem, default: PosePriorCoordinateSystem.UNDEFINED)

is_covariance_valid(self: pycolmap.PosePrior) bool
is_valid(self: pycolmap.PosePrior) bool
mergedict(self: object, arg0: dict) None
property position

(ndarray, default: [nan nan nan])

property position_covariance

(ndarray, default: [[nan nan nan] [nan nan nan] [nan nan nan]])

summary(self: pycolmap.PosePrior, write_type: bool = False) str
todict(self: pycolmap.PosePrior, recursive: bool = True) dict
class pycolmap.RANSACOptions
property confidence

(float, default: 0.9999)

property dyn_num_trials_multiplier

(float, default: 3.0)

property max_error

(float, default: 4.0)

property max_num_trials

(int, default: 100000)

mergedict(self: object, arg0: dict) None
property min_inlier_ratio

(float, default: 0.01)

property min_num_trials

(int, default: 1000)

summary(self: pycolmap.RANSACOptions, write_type: bool = False) str
todict(self: pycolmap.RANSACOptions, recursive: bool = True) dict
class pycolmap.Point2D
has_point3D(self: pycolmap.Point2D) bool
mergedict(self: object, arg0: dict) None
property point3D_id

(int, default: 18446744073709551615)

summary(self: pycolmap.Point2D, write_type: bool = False) str
todict(self: pycolmap.Point2D, recursive: bool = True) dict
property xy

(ndarray, default: [0. 0.])

class pycolmap.ListPoint2D
append(self: pycolmap.ListPoint2D, x: pycolmap.Point2D) None

Add an item to the end of the list

clear(self: pycolmap.ListPoint2D) None

Clear the contents

extend(*args, **kwargs)

Overloaded function.

  1. extend(self: pycolmap.ListPoint2D, L: pycolmap.ListPoint2D) -> None

Extend the list by appending all the items in the given list

  1. extend(self: pycolmap.ListPoint2D, L: Iterable) -> None

Extend the list by appending all the items in the given list

insert(self: pycolmap.ListPoint2D, i: int, x: pycolmap.Point2D) None

Insert an item at a given position.

pop(*args, **kwargs)

Overloaded function.

  1. pop(self: pycolmap.ListPoint2D) -> pycolmap.Point2D

Remove and return the last item

  1. pop(self: pycolmap.ListPoint2D, i: int) -> pycolmap.Point2D

Remove and return the item at index i

class pycolmap.CameraModelId

Members:

INVALID

SIMPLE_PINHOLE

PINHOLE

SIMPLE_RADIAL

SIMPLE_RADIAL_FISHEYE

RADIAL

RADIAL_FISHEYE

OPENCV

OPENCV_FISHEYE

FULL_OPENCV

FOV

THIN_PRISM_FISHEYE

RAD_TAN_THIN_PRISM_FISHEYE

FOV = <CameraModelId.FOV: 7>
FULL_OPENCV = <CameraModelId.FULL_OPENCV: 6>
INVALID = <CameraModelId.INVALID: -1>
OPENCV = <CameraModelId.OPENCV: 4>
OPENCV_FISHEYE = <CameraModelId.OPENCV_FISHEYE: 5>
PINHOLE = <CameraModelId.PINHOLE: 1>
RADIAL = <CameraModelId.RADIAL: 3>
RADIAL_FISHEYE = <CameraModelId.RADIAL_FISHEYE: 9>
RAD_TAN_THIN_PRISM_FISHEYE = <CameraModelId.RAD_TAN_THIN_PRISM_FISHEYE: 11>
SIMPLE_PINHOLE = <CameraModelId.SIMPLE_PINHOLE: 0>
SIMPLE_RADIAL = <CameraModelId.SIMPLE_RADIAL: 2>
SIMPLE_RADIAL_FISHEYE = <CameraModelId.SIMPLE_RADIAL_FISHEYE: 8>
THIN_PRISM_FISHEYE = <CameraModelId.THIN_PRISM_FISHEYE: 10>
property name
property value
class pycolmap.Camera
calibration_matrix(self: pycolmap.Camera) numpy.ndarray[numpy.float64[3, 3]]

Compute calibration matrix from params.

cam_from_img(*args, **kwargs)

Overloaded function.

  1. cam_from_img(self: pycolmap.Camera, arg0: numpy.ndarray[numpy.float64[2, 1]]) -> numpy.ndarray[numpy.float64[2, 1]]

Project point in image plane to world / infinity.

  1. cam_from_img(self: pycolmap.Camera, arg0: numpy.ndarray[numpy.float64[m, 2]]) -> numpy.ndarray[numpy.float64[m, 2]]

Project list of points in image plane to world / infinity.

  1. cam_from_img(self: pycolmap.Camera, arg0: pycolmap.ListPoint2D) -> numpy.ndarray[numpy.float64[m, 2]]

Project list of points in image plane to world / infinity.

cam_from_img_threshold(self: pycolmap.Camera, arg0: float) float

Convert pixel threshold in image plane to world space.

property camera_id

Unique identifier of the camera. (int, default: 4294967295)

static create(
camera_id: int,
model: pycolmap.CameraModelId,
focal_length: float,
width: int,
height: int,
) pycolmap.Camera
extra_params_idxs(self: pycolmap.Camera) list[int]

Indices of extra parameters in params property.

property focal_length
focal_length_idxs(self: pycolmap.Camera) list[int]

Indices of focal length parameters in params property.

property focal_length_x
property focal_length_y
has_bogus_params(self: pycolmap.Camera, arg0: float, arg1: float, arg2: float) bool

Check whether camera has bogus parameters.

property has_prior_focal_length

(bool, default: False)

property height

Height of camera sensor. (int, default: 0)

img_from_cam(*args, **kwargs)

Overloaded function.

  1. img_from_cam(self: pycolmap.Camera, arg0: numpy.ndarray[numpy.float64[2, 1]]) -> numpy.ndarray[numpy.float64[2, 1]]

Project point from world / infinity to image plane.

  1. img_from_cam(self: pycolmap.Camera, arg0: numpy.ndarray[numpy.float64[m, 2]]) -> numpy.ndarray[numpy.float64[m, 2]]

Project list of points from world / infinity to image plane.

  1. img_from_cam(self: pycolmap.Camera, arg0: numpy.ndarray[numpy.float64[m, 3]]) -> object

Project list of points from world / infinity to image plane.

  1. img_from_cam(self: pycolmap.Camera, arg0: pycolmap.ListPoint2D) -> numpy.ndarray[numpy.float64[m, 2]]

Project list of points from world / infinity to image plane.

mean_focal_length(self: pycolmap.Camera) float
mergedict(self: object, arg0: dict) None
property model

Camera model. (CameraModelId, default: CameraModelId.INVALID)

property params

Camera parameters. (ndarray, default: [])

property params_info

Get human-readable information about the parameter vector ordering.

params_to_string(self: pycolmap.Camera) str

Concatenate parameters as comma-separated list.

principal_point_idxs(self: pycolmap.Camera) list[int]

Indices of principal point parameters in params property.

property principal_point_x
property principal_point_y
rescale(*args, **kwargs)

Overloaded function.

  1. rescale(self: pycolmap.Camera, arg0: int, arg1: int) -> None

Rescale camera dimensions to (width_height) and accordingly the focal length and and the principal point.

  1. rescale(self: pycolmap.Camera, arg0: float) -> None

Rescale camera dimensions by given factor and accordingly the focal length and and the principal point.

set_params_from_string(self: pycolmap.Camera, arg0: str) bool

Set camera parameters from comma-separated list.

summary(self: pycolmap.Camera, write_type: bool = False) str
todict(self: pycolmap.Camera, recursive: bool = True) dict
verify_params(self: pycolmap.Camera) bool

Check whether parameters are valid, i.e. the parameter vector has the correct dimensions that match the specified camera model.

property width

Width of camera sensor. (int, default: 0)

class pycolmap.MapCameraIdToCamera
items(self: pycolmap.MapCameraIdToCamera) pycolmap.ItemsView
keys(self: pycolmap.MapCameraIdToCamera) pycolmap.KeysView
values(self: pycolmap.MapCameraIdToCamera) pycolmap.ValuesView
class pycolmap.KeysView
class pycolmap.ValuesView
class pycolmap.ItemsView
class pycolmap.Image
property cam_from_world

The pose of the image, defined as the transformation from world to camera space. (Rigid3d, default: Rigid3d(quat_xyzw=[0, 0, 0, 1], t=[0, 0, 0]))

property camera

The address of the camera (NoneType, default: None)

property camera_id

Unique identifier of the camera. (int, default: 4294967295)

get_valid_point2D_ids(self: pycolmap.Image) list[int]
get_valid_points2D(self: pycolmap.Image) pycolmap.ListPoint2D
has_camera_id(self: pycolmap.Image) bool

Check whether identifier of camera has been set.

has_camera_ptr(self: pycolmap.Image) bool

Check whether the camera pointer has been set.

has_point3D(self: pycolmap.Image, point3D_id: int) bool

Check whether one of the image points is part of a 3D point track.

property image_id

Unique identifier of image. (int, default: 4294967295)

mergedict(self: object, arg0: dict) None
property name

Name of the image. (str, default: )

num_points2D(self: pycolmap.Image) int

Get the number of image points (keypoints).

property num_points3D

Get the number of triangulations, i.e. the number of points that are part of a 3D point track. (int, default: 0)

point2D(self: pycolmap.Image, point2D_idx: int) pycolmap.Point2D

Direct accessor for a point2D.

property points2D

Array of Points2D (=keypoints). (ListPoint2D, default: [])

project_point(
self: pycolmap.Image,
arg0: numpy.ndarray[numpy.float64[3, 1]],
) numpy.ndarray[numpy.float64[2, 1]] | None

Project 3D point onto the image

projection_center(self: pycolmap.Image) numpy.ndarray[numpy.float64[3, 1]]

Extract the projection center in world space.

property registered

Whether image is registered in the reconstruction. (bool, default: False)

reset_camera_ptr(self: pycolmap.Image) None

Make the camera pointer a nullptr.

reset_point3D_for_point2D(self: pycolmap.Image, point2D_idx: int) None

Set the point as not triangulated, i.e. it is not part of a 3D point track

set_point3D_for_point2D(self: pycolmap.Image, point2D_Idx: int, point3D_id: int) None

Set the point as triangulated, i.e. it is part of a 3D point track.

summary(self: pycolmap.Image, write_type: bool = False) str
todict(self: pycolmap.Image, recursive: bool = True) dict
viewing_direction(self: pycolmap.Image) numpy.ndarray[numpy.float64[3, 1]]

Extract the viewing direction of the image.

class pycolmap.MapImageIdToImage
items(self: pycolmap.MapImageIdToImage) pycolmap.ItemsView
keys(self: pycolmap.MapImageIdToImage) pycolmap.KeysView
values(self: pycolmap.MapImageIdToImage) pycolmap.ValuesView
class pycolmap.TrackElement
property image_id

(int, default: 4294967295)

mergedict(self: object, arg0: dict) None
property point2D_idx

(int, default: 4294967295)

summary(self: pycolmap.TrackElement, write_type: bool = False) str
todict(self: pycolmap.TrackElement, recursive: bool = True) dict
class pycolmap.Track
add_element(self: pycolmap.Track, image_id: int, point2D_idx: int) None

Add an observation to the track.

add_elements(self: pycolmap.Track, elements: list[pycolmap.TrackElement]) None

Add multiple elements.

append(self: pycolmap.Track, element: pycolmap.TrackElement) None
delete_element(self: pycolmap.Track, image_id: int, point2D_idx: int) None

Delete observation from track.

property elements

(list, default: [])

length(self: pycolmap.Track) int

Track Length.

mergedict(self: object, arg0: dict) None
remove(*args, **kwargs)

Overloaded function.

  1. remove(self: pycolmap.Track, index: int) -> None

Remove TrackElement at index.

  1. remove(self: pycolmap.Track, image_id: int, point2D_idx: int) -> None

Remove TrackElement with (image_id, point2D_idx).

summary(self: pycolmap.Track, write_type: bool = False) str
todict(self: pycolmap.Track, recursive: bool = True) dict
class pycolmap.Point3D
property color

(ndarray, default: [0 0 0])

property error

(float, default: -1.0)

mergedict(self: object, arg0: dict) None
summary(self: pycolmap.Point3D, write_type: bool = False) str
todict(self: pycolmap.Point3D, recursive: bool = True) dict
property track

(Track, default: Track(length=0))

property xyz

(ndarray, default: [0. 0. 0.])

class pycolmap.MapPoint3DIdToPoint3D
items(self: pycolmap.MapPoint3DIdToPoint3D) pycolmap.ItemsView
keys(self: pycolmap.MapPoint3DIdToPoint3D) pycolmap.KeysView
values(self: pycolmap.MapPoint3DIdToPoint3D) pycolmap.ValuesView
class pycolmap.Correspondence
property image_id
property point2D_idx
class pycolmap.CorrespondenceGraph
add_correspondences(
self: pycolmap.CorrespondenceGraph,
image_id1: int,
image_id2: int,
correspondences: numpy.ndarray[numpy.uint32[m, 2]],
) None
add_image(self: pycolmap.CorrespondenceGraph, image_id: int, num_points2D: int) None
exists_image(self: pycolmap.CorrespondenceGraph, image_id: int) bool
extract_correspondences(
self: pycolmap.CorrespondenceGraph,
image_id: int,
point2D_idx: int,
) list[pycolmap.Correspondence]
extract_transitive_correspondences(
self: pycolmap.CorrespondenceGraph,
image_id: int,
point2D_idx: int,
transitivity: int,
) list[pycolmap.Correspondence]
finalize(self: pycolmap.CorrespondenceGraph) None
find_correspondences_between_images(
self: pycolmap.CorrespondenceGraph,
image_id1: int,
image_id2: int,
) numpy.ndarray[numpy.uint32[m, 2]]
has_correspondences(self: pycolmap.CorrespondenceGraph, image_id: int, point2D_idx: int) bool
is_two_view_observation(self: pycolmap.CorrespondenceGraph, image_id: int, point2D_idx: int) bool
num_correspondences_between_all_images(self: pycolmap.CorrespondenceGraph) dict[int, int]
num_correspondences_between_images(
self: pycolmap.CorrespondenceGraph,
image_id1: int,
image_id2: int,
) int
num_correspondences_for_image(self: pycolmap.CorrespondenceGraph, image_id: int) int
num_image_pairs(self: pycolmap.CorrespondenceGraph) int
num_images(self: pycolmap.CorrespondenceGraph) int
num_observations_for_image(self: pycolmap.CorrespondenceGraph, image_id: int) int
class pycolmap.Reconstruction
add_camera(self: pycolmap.Reconstruction, camera: pycolmap.Camera) None

Add new camera. There is only one camera per image, while multiple images might be taken by the same camera.

add_image(self: pycolmap.Reconstruction, image: pycolmap.Image) None

Add new image. Its camera must have been added before. If its camera object is unset, it will be automatically populated from the added cameras.

add_observation(
self: pycolmap.Reconstruction,
point3D_id: int,
track_element: pycolmap.TrackElement,
) None

Add observation to existing 3D point.

add_point3D(
self: pycolmap.Reconstruction,
xyz: numpy.ndarray[numpy.float64[3, 1]],
track: pycolmap.Track,
color: numpy.ndarray[numpy.uint8[3, 1]] = array([0, 0, 0], dtype=uint8),
) int

Add new 3D object, and return its unique ID.

camera(self: pycolmap.Reconstruction, camera_id: int) pycolmap.Camera

Direct accessor for a camera.

property cameras
check(self: pycolmap.Reconstruction) None

Check if current reconstruction is well formed.

compute_bounding_box(
self: pycolmap.Reconstruction,
p0: float = 0.0,
p1: float = 1.0,
) tuple[numpy.ndarray[numpy.float64[3, 1]], numpy.ndarray[numpy.float64[3, 1]]]
compute_mean_observations_per_reg_image(self: pycolmap.Reconstruction) float
compute_mean_reprojection_error(self: pycolmap.Reconstruction) float
compute_mean_track_length(self: pycolmap.Reconstruction) float
compute_num_observations(self: pycolmap.Reconstruction) int
create_image_dirs(self: pycolmap.Reconstruction, path: str) None

Create all image sub-directories in the given path.

crop(
self: pycolmap.Reconstruction,
bbox: tuple[numpy.ndarray[numpy.float64[3, 1]], numpy.ndarray[numpy.float64[3, 1]]],
) pycolmap.Reconstruction
delete_observation(self: pycolmap.Reconstruction, image_id: int, point2D_idx: int) None

Delete one observation from an image and the corresponding 3D point. Note that this deletes the entire 3D point, if the track has two elements prior to calling this method.

delete_point3D(self: pycolmap.Reconstruction, point3D_id: int) None

Delete a 3D point, and all its references in the observed images.

deregister_image(self: pycolmap.Reconstruction, image_id: int) None

De-register an existing image, and all its references.

exists_camera(self: pycolmap.Reconstruction, camera_id: int) bool
exists_image(self: pycolmap.Reconstruction, image_id: int) bool
exists_point3D(self: pycolmap.Reconstruction, point3D_id: int) bool
export_PLY(self: pycolmap.Reconstruction, output_path: str) None

Export 3D points to PLY format (.ply).

extract_colors_for_all_images(self: pycolmap.Reconstruction, path: str) None

Extract colors for all 3D points by computing the mean color of all images.

extract_colors_for_image(self: pycolmap.Reconstruction, image_id: int, path: str) bool

Extract colors for 3D points of given image. Colors will be extracted only for 3D points which are completely black. Return True if the image could be read at the given path.

find_common_reg_image_ids(
self: pycolmap.Reconstruction,
other: pycolmap.Reconstruction,
) list[tuple[int, int]]

Find images that are both present in this and the given reconstruction.

find_image_with_name(self: pycolmap.Reconstruction, name: str) pycolmap.Image

Find image with matching name. Returns None if no match is found.

image(self: pycolmap.Reconstruction, image_id: int) pycolmap.Image

Direct accessor for an image.

property images
import_PLY(self: pycolmap.Reconstruction, path: str) None

Import from PLY format. Note that these import functions areonly intended for visualization of data and usable for reconstruction.

is_image_registered(self: pycolmap.Reconstruction, image_id: int) bool

Check if image is registered.

merge_points3D(self: pycolmap.Reconstruction, point3D_id1: int, point3D_id2: int) int

Merge two 3D points and return new identifier of new 3D point.The location of the merged 3D point is a weighted average of the two original 3D point’s locations according to their track lengths.

normalize(
self: pycolmap.Reconstruction,
fixed_scale: bool = False,
extent: float = 10.0,
p0: float = 0.1,
p1: float = 0.9,
use_images: bool = True,
) pycolmap.Sim3d

Normalize scene by scaling and translation to avoid degeneratevisualization after bundle adjustment and to improve numericalstability of algorithms.

Translates scene such that the mean of the camera centers or pointlocations are at the origin of the coordinate system.

Scales scene such that the minimum and maximum camera centers are at the given extent, whereas p0 and p1 determine the minimum and maximum percentiles of the camera centers considered.

num_cameras(self: pycolmap.Reconstruction) int
num_images(self: pycolmap.Reconstruction) int
num_points3D(self: pycolmap.Reconstruction) int
num_reg_images(self: pycolmap.Reconstruction) int
point3D(self: pycolmap.Reconstruction, point3D_id: int) pycolmap.Point3D

Direct accessor for a Point3D.

point3D_ids(self: pycolmap.Reconstruction) set[int]
property points3D
read(self: pycolmap.Reconstruction, sfm_dir: str) None

Read reconstruction in COLMAP format. Prefer binary.

read_binary(self: pycolmap.Reconstruction, path: str) None
read_text(self: pycolmap.Reconstruction, path: str) None
reg_image_ids(self: pycolmap.Reconstruction) list[int]
register_image(self: pycolmap.Reconstruction, image_id: int) None

Register an existing image.

summary(self: pycolmap.Reconstruction) str
tear_down(self: pycolmap.Reconstruction) None
transform(self: pycolmap.Reconstruction, new_from_old_world: pycolmap.Sim3d) None

Apply the 3D similarity transformation to all images and points.

update_point_3d_errors(self: pycolmap.Reconstruction) None
write(self: pycolmap.Reconstruction, output_dir: str) None

Write reconstruction in COLMAP binary format.

write_binary(self: pycolmap.Reconstruction, path: str) None
write_text(self: pycolmap.Reconstruction, path: str) None
class pycolmap.ReconstructionManager
add(self: pycolmap.ReconstructionManager) int
clear(self: pycolmap.ReconstructionManager) None
delete(self: pycolmap.ReconstructionManager, idx: int) None
get(self: pycolmap.ReconstructionManager, idx: int) pycolmap.Reconstruction
read(self: pycolmap.ReconstructionManager, path: str) int
size(self: pycolmap.ReconstructionManager) int
write(self: pycolmap.ReconstructionManager, path: str) None
class pycolmap.TwoViewGeometryConfiguration

Members:

UNDEFINED

DEGENERATE

CALIBRATED

UNCALIBRATED

PLANAR

PANORAMIC

PLANAR_OR_PANORAMIC

WATERMARK

MULTIPLE

CALIBRATED = <TwoViewGeometryConfiguration.CALIBRATED: 2>
DEGENERATE = <TwoViewGeometryConfiguration.DEGENERATE: 1>
MULTIPLE = <TwoViewGeometryConfiguration.MULTIPLE: 8>
PANORAMIC = <TwoViewGeometryConfiguration.PANORAMIC: 5>
PLANAR = <TwoViewGeometryConfiguration.PLANAR: 4>
PLANAR_OR_PANORAMIC = <TwoViewGeometryConfiguration.PLANAR_OR_PANORAMIC: 6>
UNCALIBRATED = <TwoViewGeometryConfiguration.UNCALIBRATED: 3>
UNDEFINED = <TwoViewGeometryConfiguration.UNDEFINED: 0>
WATERMARK = <TwoViewGeometryConfiguration.WATERMARK: 7>
property name
property value
class pycolmap.TwoViewGeometry
property E

(ndarray, default: [[0. 0. 0.] [0. 0. 0.] [0. 0. 0.]])

property F

(ndarray, default: [[0. 0. 0.] [0. 0. 0.] [0. 0. 0.]])

property H

(ndarray, default: [[0. 0. 0.] [0. 0. 0.] [0. 0. 0.]])

property cam2_from_cam1

(Rigid3d, default: Rigid3d(quat_xyzw=[0, 0, 0, 1], t=[0, 0, 0]))

property config

(int, default: 0)

property inlier_matches

(ndarray, default: [])

invert(self: pycolmap.TwoViewGeometry) None
mergedict(self: object, arg0: dict) None
summary(self: pycolmap.TwoViewGeometry, write_type: bool = False) str
todict(self: pycolmap.TwoViewGeometry, recursive: bool = True) dict
property tri_angle

(float, default: -1.0)

class pycolmap.Database
clear_all_tables(self: pycolmap.Database) None
clear_cameras(self: pycolmap.Database) None
clear_descriptors(self: pycolmap.Database) None
clear_images(self: pycolmap.Database) None
clear_keypoints(self: pycolmap.Database) None
clear_matches(self: pycolmap.Database) None
clear_pose_priors(self: pycolmap.Database) None
clear_two_view_geometries(self: pycolmap.Database) None
close(self: pycolmap.Database) None
delete_inlier_matches(self: pycolmap.Database, image_id1: int, image_id2: int) None
delete_matches(self: pycolmap.Database, image_id1: int, image_id2: int) None
exists_camera(self: pycolmap.Database, camera_id: int) bool
exists_descriptors(self: pycolmap.Database, image_id: int) bool
exists_image(*args, **kwargs)

Overloaded function.

  1. exists_image(self: pycolmap.Database, image_id: int) -> bool

  2. exists_image(self: pycolmap.Database, name: str) -> bool

exists_inlier_matches(self: pycolmap.Database, image_id1: int, image_id2: int) bool
exists_keypoints(self: pycolmap.Database, image_id: int) bool
exists_matches(self: pycolmap.Database, image_id1: int, image_id2: int) bool
exists_pose_prior(self: pycolmap.Database, image_id: int) bool
static image_pair_to_pair_id(image_id1: int, image_id2: int) int
static merge(database1: pycolmap.Database, database2: pycolmap.Database, merged_database: pycolmap.Database) None
property num_cameras
property num_descriptors
num_descriptors_for_image(self: pycolmap.Database, image_id: int) int
property num_images
property num_inlier_matches
property num_keypoints
num_keypoints_for_image(self: pycolmap.Database, image_id: int) int
property num_matched_image_pairs
property num_matches
property num_pose_priors
property num_verified_image_pairs
open(self: pycolmap.Database, path: str) None
static pair_id_to_image_pair(pair_id: int) tuple[int, int]
read_all_cameras(self: pycolmap.Database) list[pycolmap.Camera]
read_all_images(self: pycolmap.Database) list[pycolmap.Image]
read_camera(self: pycolmap.Database, camera_id: int) pycolmap.Camera
read_descriptors(self: pycolmap.Database, image_id: int) numpy.ndarray[numpy.uint8[m, n]]
read_image(*args, **kwargs)

Overloaded function.

  1. read_image(self: pycolmap.Database, image_id: int) -> pycolmap.Image

  2. read_image(self: pycolmap.Database, name: str) -> pycolmap.Image

read_keypoints(self: pycolmap.Database, image_id: int) numpy.ndarray[numpy.float32[m, n]]
read_matches(self: pycolmap.Database, image_id1: int, image_id2: int) numpy.ndarray[numpy.uint32[m, 2]]
read_pose_prior(self: pycolmap.Database, image_id: int) pycolmap.PosePrior
read_two_view_geometries(self: pycolmap.Database) tuple[list[int], list[pycolmap.TwoViewGeometry]]
read_two_view_geometry(self: pycolmap.Database, image_id1: int, image_id2: int) pycolmap.TwoViewGeometry
read_two_view_geometry_num_inliers(self: pycolmap.Database) tuple[list[tuple[int, int]], list[int]]
static swap_image_pair(image_id1: int, image_id2: int) bool
update_camera(self: pycolmap.Database, camera: pycolmap.Camera) None
update_image(self: pycolmap.Database, image: pycolmap.Image) None
write_camera(self: pycolmap.Database, camera: pycolmap.Camera, use_camera_id: bool = False) int
write_descriptors(
self: pycolmap.Database,
image_id: int,
descriptors: numpy.ndarray[numpy.uint8[m, n]],
) None
write_image(self: pycolmap.Database, image: pycolmap.Image, use_image_id: bool = False) int
write_keypoints(self: pycolmap.Database, image_id: int, keypoints: numpy.ndarray[numpy.float32[m, n]]) None
write_matches(
self: pycolmap.Database,
image_id1: int,
image_id2: int,
matches: numpy.ndarray[numpy.uint32[m, 2]],
) None
write_pose_prior(self: pycolmap.Database, image_id: int, pose_prior: pycolmap.PosePrior) None
write_two_view_geometry(
self: pycolmap.Database,
image_id1: int,
image_id2: int,
two_view_geometry: pycolmap.TwoViewGeometry,
) None
class pycolmap.DatabaseTransaction
class pycolmap.DatabaseCache
property cameras
property correspondence_graph
static create(
database: pycolmap.Database,
min_num_matches: int,
ignore_watermarks: bool,
image_names: set[str],
) pycolmap.DatabaseCache
exists_camera(self: pycolmap.DatabaseCache, camera_id: int) bool
exists_image(self: pycolmap.DatabaseCache, image_id: int) bool
find_image_with_name(self: pycolmap.DatabaseCache, name: str) pycolmap.Image
property images
num_cameras(self: pycolmap.DatabaseCache) int
num_images(self: pycolmap.DatabaseCache) int
class pycolmap.AbsolutePoseEstimationOptions
property estimate_focal_length

(bool, default: False)

property max_focal_length_ratio

(float, default: 5.0)

mergedict(self: object, arg0: dict) None
property min_focal_length_ratio

(float, default: 0.2)

property num_focal_length_samples

(int, default: 30)

property ransac

(RANSACOptions, default: RANSACOptions(max_error=12.0, min_inlier_ratio=0.1, confidence=0.99999, dyn_num_trials_multiplier=3.0, min_num_trials=100, max_num_trials=10000))

summary(self: pycolmap.AbsolutePoseEstimationOptions, write_type: bool = False) str
todict(self: pycolmap.AbsolutePoseEstimationOptions, recursive: bool = True) dict
class pycolmap.AbsolutePoseRefinementOptions
property gradient_tolerance

(float, default: 1.0)

property loss_function_scale

(float, default: 1.0)

property max_num_iterations

(int, default: 100)

mergedict(self: object, arg0: dict) None
property print_summary

(bool, default: False)

property refine_extra_params

(bool, default: False)

property refine_focal_length

(bool, default: False)

summary(self: pycolmap.AbsolutePoseRefinementOptions, write_type: bool = False) str
todict(self: pycolmap.AbsolutePoseRefinementOptions, recursive: bool = True) dict
pycolmap.absolute_pose_estimation(
points2D: numpy.ndarray[numpy.float64[m, 2]],
points3D: numpy.ndarray[numpy.float64[m, 3]],
camera: pycolmap.Camera,
estimation_options: pycolmap.AbsolutePoseEstimationOptions = AbsolutePoseEstimationOptions(),
refinement_options: pycolmap.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(),
return_covariance: bool = False,
) dict | None

Absolute pose estimation with non-linear refinement.

pycolmap.pose_refinement(
cam_from_world: pycolmap.Rigid3d,
points2D: numpy.ndarray[numpy.float64[m, 2]],
points3D: numpy.ndarray[numpy.float64[m, 3]],
inlier_mask: numpy.ndarray[bool[m, 1]],
camera: pycolmap.Camera,
refinement_options: pycolmap.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(),
) dict | None

Non-linear refinement of absolute pose.

class pycolmap.ImageAlignmentError
property image_name
property proj_center_error
property rotation_error_deg
pycolmap.align_reconstructions_via_reprojections(
src_reconstruction: pycolmap.Reconstruction,
tgt_reconstruction: pycolmap.Reconstruction,
min_inlier_observations: float = 0.3,
max_reproj_error: float = 8.0,
) pycolmap.Sim3d | None
pycolmap.align_reconstructions_via_proj_centers(
src_reconstruction: pycolmap.Reconstruction,
tgt_reconstruction: pycolmap.Reconstruction,
max_proj_center_error: float,
) pycolmap.Sim3d | None
pycolmap.align_reconstructions_via_points(
src_reconstruction: pycolmap.Reconstruction,
tgt_reconstruction: pycolmap.Reconstruction,
min_common_observations: int = 3,
max_error: float = 0.005,
min_inlier_ratio: float = 0.9,
) pycolmap.Sim3d | None
pycolmap.align_reconstruction_to_locations(
src: pycolmap.Reconstruction,
image_names: list[str],
locations: numpy.ndarray[numpy.float64[m, 3]],
min_common_points: int,
ransac_options: pycolmap.RANSACOptions,
) pycolmap.Sim3d | None
pycolmap.compare_reconstructions(
reconstruction1: pycolmap.Reconstruction,
reconstruction2: pycolmap.Reconstruction,
alignment_error: str = 'reprojection',
min_inlier_observations: float = 0.3,
max_reproj_error: float = 8.0,
max_proj_center_error: float = 0.1,
) dict | None
class pycolmap.LossFunctionType

Members:

TRIVIAL

SOFT_L1

CAUCHY

CAUCHY = <LossFunctionType.CAUCHY: 2>
SOFT_L1 = <LossFunctionType.SOFT_L1: 1>
TRIVIAL = <LossFunctionType.TRIVIAL: 0>
property name
property value
class pycolmap.BundleAdjustmentOptions
create_loss_function(self: pycolmap.BundleAdjustmentOptions) pyceres.LossFunction
property gpu_index

Which GPU to use for solving the problem. (str, default: -1)

property loss_function_scale

Scaling factor determines residual at which robustification takes place. (float, default: 1.0)

property loss_function_type

Loss function types: Trivial (non-robust) and Cauchy (robust) loss. (LossFunctionType, default: LossFunctionType.TRIVIAL)

property max_num_images_direct_dense_cpu_solver

Threshold to switch between direct, sparse, and iterative solvers. (int, default: 50)

property max_num_images_direct_dense_gpu_solver

Threshold to switch between direct, sparse, and iterative solvers. (int, default: 200)

property max_num_images_direct_sparse_cpu_solver

Threshold to switch between direct, sparse, and iterative solvers. (int, default: 1000)

property max_num_images_direct_sparse_gpu_solver

Threshold to switch between direct, sparse, and iterative solvers. (int, default: 4000)

mergedict(self: object, arg0: dict) None
property min_num_images_gpu_solver

Minimum number of images to use the GPU solver. (int, default: 50)

property min_num_residuals_for_cpu_multi_threading

Minimum number of residuals to enable multi-threading. Note that single-threaded is typically better for small bundle adjustment problems due to the overhead of threading. (int, default: 50000)

property print_summary

Whether to print a final summary. (bool, default: True)

property refine_extra_params

Whether to refine the extra parameter group. (bool, default: True)

property refine_extrinsics

Whether to refine the extrinsic parameter group. (bool, default: True)

property refine_focal_length

Whether to refine the focal length parameter group. (bool, default: True)

property refine_principal_point

Whether to refine the principal point parameter group. (bool, default: False)

property solver_options

Options for the Ceres solver. Using this member requires having PyCeres installed. (SolverOptions, default: <pyceres.SolverOptions object at 0x7972fedaa7b0>)

summary(self: pycolmap.BundleAdjustmentOptions, write_type: bool = False) str
todict(self: pycolmap.BundleAdjustmentOptions, recursive: bool = True) dict
property use_gpu

Whether to use Ceres’ CUDA linear algebra library, if available. (bool, default: False)

class pycolmap.BundleAdjustmentConfig
add_constant_point(self: pycolmap.BundleAdjustmentConfig, point3D_id: int) None
add_image(self: pycolmap.BundleAdjustmentConfig, image_id: int) None
add_variable_point(self: pycolmap.BundleAdjustmentConfig, point3D_id: int) None
property constant_cam_poses

(set, default: set())

constant_cam_positions(self: pycolmap.BundleAdjustmentConfig, image_id: int) list[int]
property constant_intrinsics

(set, default: set())

property constant_point3D_ids

(set, default: set())

has_constant_cam_intrinsics(self: pycolmap.BundleAdjustmentConfig, camera_id: int) bool
has_constant_cam_pose(self: pycolmap.BundleAdjustmentConfig, image_id: int) bool
has_constant_cam_positions(self: pycolmap.BundleAdjustmentConfig, image_id: int) bool
has_constant_point(self: pycolmap.BundleAdjustmentConfig, point3D_id: int) bool
has_image(self: pycolmap.BundleAdjustmentConfig, image_id: int) bool
has_point(self: pycolmap.BundleAdjustmentConfig, point3D_id: int) bool
has_variable_point(self: pycolmap.BundleAdjustmentConfig, point3D_id: int) bool
property image_ids

(set, default: set())

mergedict(self: object, arg0: dict) None
num_constant_cam_intrinsics(self: pycolmap.BundleAdjustmentConfig) int
num_constant_cam_poses(self: pycolmap.BundleAdjustmentConfig) int
num_constant_cam_positions(self: pycolmap.BundleAdjustmentConfig) int
num_constant_points(self: pycolmap.BundleAdjustmentConfig) int
num_images(self: pycolmap.BundleAdjustmentConfig) int
num_points(self: pycolmap.BundleAdjustmentConfig) int
num_residuals(
self: pycolmap.BundleAdjustmentConfig,
reconstruction: pycolmap.Reconstruction,
) int
num_variable_points(self: pycolmap.BundleAdjustmentConfig) int
remove_constant_point(self: pycolmap.BundleAdjustmentConfig, point3D_id: int) None
remove_image(self: pycolmap.BundleAdjustmentConfig, image_id: int) None
remove_variable_cam_positions(self: pycolmap.BundleAdjustmentConfig, image_id: int) None
remove_variable_point(self: pycolmap.BundleAdjustmentConfig, point3D_id: int) None
set_constant_cam_intrinsics(self: pycolmap.BundleAdjustmentConfig, camera_id: int) None
set_constant_cam_pose(self: pycolmap.BundleAdjustmentConfig, image_id: int) None
set_constant_cam_positions(
self: pycolmap.BundleAdjustmentConfig,
image_id: int,
idxs: list[int],
) None
set_variable_cam_intrinsics(self: pycolmap.BundleAdjustmentConfig, camera_id: int) None
set_variable_cam_pose(self: pycolmap.BundleAdjustmentConfig, image_id: int) None
summary(self: pycolmap.BundleAdjustmentConfig, write_type: bool = False) str
todict(self: pycolmap.BundleAdjustmentConfig, recursive: bool = True) dict
property variable_point3D_ids

(set, default: set())

class pycolmap.BundleAdjuster
property config
property options
property problem
set_up_problem(
self: pycolmap.BundleAdjuster,
reconstruction: pycolmap.Reconstruction,
loss_function: pyceres.LossFunction,
) None
set_up_solver_options(
self: pycolmap.BundleAdjuster,
problem: pyceres.Problem,
input_solver_options: pyceres.SolverOptions,
) pyceres.SolverOptions
solve(self: pycolmap.BundleAdjuster, reconstruction: pycolmap.Reconstruction) bool
property summary
pycolmap.estimate_pose_covariance_from_ba_ceres_backend(
problem: pyceres.Problem,
reconstruction: pycolmap.Reconstruction,
) dict | None
pycolmap.estimate_pose_covariance_from_ba(
problem: pyceres.Problem,
reconstruction: pycolmap.Reconstruction,
damping: float = 1e-08,
) dict | None
class pycolmap.BundleAdjustmentCovarianceEstimatorBase
compute(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase) bool
compute_full(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase) bool
get_covariance(*args, **kwargs)

Overloaded function.

  1. get_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, paramter_block: numpy.ndarray[numpy.float64]) -> numpy.ndarray[numpy.float64[m, n]]

  2. get_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, parameter_blocks: list[numpy.ndarray[numpy.float64]]) -> numpy.ndarray[numpy.float64[m, n]]

  3. get_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, parameter_block1: numpy.ndarray[numpy.float64], parameter_block2: numpy.ndarray[numpy.float64]) -> numpy.ndarray[numpy.float64[m, n]]

get_pose_covariance(*args, **kwargs)

Overloaded function.

  1. get_pose_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase) -> numpy.ndarray[numpy.float64[m, n]]

  2. get_pose_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, image_id: int) -> numpy.ndarray[numpy.float64[m, n]]

  3. get_pose_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, image_ids: list[int]) -> numpy.ndarray[numpy.float64[m, n]]

  4. get_pose_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, image_id1: int, image_id2: int) -> numpy.ndarray[numpy.float64[m, n]]

  5. get_pose_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, paramter_block: numpy.ndarray[numpy.float64]) -> numpy.ndarray[numpy.float64[m, n]]

  6. get_pose_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, parameter_blocks: list[numpy.ndarray[numpy.float64]]) -> numpy.ndarray[numpy.float64[m, n]]

  7. get_pose_covariance(self: pycolmap.BundleAdjustmentCovarianceEstimatorBase, parameter_block1: numpy.ndarray[numpy.float64], parameter_block2: numpy.ndarray[numpy.float64]) -> numpy.ndarray[numpy.float64[m, n]]

has_block(
self: pycolmap.BundleAdjustmentCovarianceEstimatorBase,
parameter_block: float,
) bool
has_pose(
self: pycolmap.BundleAdjustmentCovarianceEstimatorBase,
image_id: int,
) bool
has_pose_block(
self: pycolmap.BundleAdjustmentCovarianceEstimatorBase,
parameter_block: float,
) bool
has_reconstruction(
self: pycolmap.BundleAdjustmentCovarianceEstimatorBase,
) bool
has_valid_full_covariance(
self: pycolmap.BundleAdjustmentCovarianceEstimatorBase,
) bool
has_valid_pose_covariance(
self: pycolmap.BundleAdjustmentCovarianceEstimatorBase,
) bool
set_pose_blocks(
self: pycolmap.BundleAdjustmentCovarianceEstimatorBase,
pose_blocks: list[numpy.ndarray[numpy.float64]],
) None
class pycolmap.BundleAdjustmentCovarianceEstimatorCeresBackend
class pycolmap.BundleAdjustmentCovarianceEstimator
factorize(self: pycolmap.BundleAdjustmentCovarianceEstimator) bool
factorize_full(self: pycolmap.BundleAdjustmentCovarianceEstimator) bool
has_valid_full_factorization(
self: pycolmap.BundleAdjustmentCovarianceEstimator,
) bool
has_valid_pose_factorization(
self: pycolmap.BundleAdjustmentCovarianceEstimator,
) bool
pycolmap.essential_matrix_estimation(
points2D1: numpy.ndarray[numpy.float64[m, 2]],
points2D2: numpy.ndarray[numpy.float64[m, 2]],
camera1: pycolmap.Camera,
camera2: pycolmap.Camera,
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None

LORANSAC + 5-point algorithm.

pycolmap.fundamental_matrix_estimation(
points2D1: numpy.ndarray[numpy.float64[m, 2]],
points2D2: numpy.ndarray[numpy.float64[m, 2]],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None

LORANSAC + 7-point algorithm.

pycolmap.rig_absolute_pose_estimation(
points2D: numpy.ndarray[numpy.float64[m, 2]],
points3D: numpy.ndarray[numpy.float64[m, 3]],
camera_idxs: list[int],
cams_from_rig: list[pycolmap.Rigid3d],
cameras: list[pycolmap.Camera],
estimation_options: pycolmap.RANSACOptions = AbsolutePoseEstimationOptions().ransac,
refinement_options: pycolmap.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(),
return_covariance: bool = False,
) dict | None

Absolute pose estimation with non-linear refinement for a multi-camera rig.

pycolmap.homography_matrix_estimation(
points2D1: numpy.ndarray[numpy.float64[m, 2]],
points2D2: numpy.ndarray[numpy.float64[m, 2]],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None

LORANSAC + 4-point DLT algorithm.

class pycolmap.TriangulationResidualType

Members:

ANGULAR_ERROR

REPROJECTION_ERROR

ANGULAR_ERROR = <TriangulationResidualType.ANGULAR_ERROR: 0>
REPROJECTION_ERROR = <TriangulationResidualType.REPROJECTION_ERROR: 1>
property name
property value
class pycolmap.EstimateTriangulationOptions
mergedict(self: object, arg0: dict) None
property min_tri_angle

Minimum triangulation angle in radians. (float, default: 0.0)

property ransac

RANSAC options. (RANSACOptions, default: RANSACOptions(max_error=0.03490658503988659, min_inlier_ratio=0.02, confidence=0.9999, dyn_num_trials_multiplier=3.0, min_num_trials=0, max_num_trials=10000))

property residual_type

Employed residual type. (TriangulationResidualType, default: TriangulationResidualType.ANGULAR_ERROR)

summary(self: pycolmap.EstimateTriangulationOptions, write_type: bool = False) str
todict(self: pycolmap.EstimateTriangulationOptions, recursive: bool = True) dict
pycolmap.estimate_triangulation(
points: numpy.ndarray[numpy.float64[m, 2]],
cams_from_world: list[pycolmap.Rigid3d],
cameras: list[pycolmap.Camera],
options: pycolmap.EstimateTriangulationOptions = EstimateTriangulationOptions(),
) dict | None

Robustly estimate 3D point from observations in multiple views using RANSAC

class pycolmap.TwoViewGeometryOptions
property compute_relative_pose

(bool, default: False)

property detect_watermark

(bool, default: True)

property force_H_use

(bool, default: False)

property max_H_inlier_ratio

(float, default: 0.8)

mergedict(self: object, arg0: dict) None
property min_E_F_inlier_ratio

(float, default: 0.95)

property min_num_inliers

(int, default: 15)

property multiple_ignore_watermark

(bool, default: True)

property multiple_models

(bool, default: False)

property ransac

(RANSACOptions, default: RANSACOptions(max_error=4.0, min_inlier_ratio=0.25, confidence=0.999, dyn_num_trials_multiplier=3.0, min_num_trials=100, max_num_trials=10000))

summary(self: pycolmap.TwoViewGeometryOptions, write_type: bool = False) str
todict(self: pycolmap.TwoViewGeometryOptions, recursive: bool = True) dict
property watermark_border_size

(float, default: 0.1)

property watermark_min_inlier_ratio

(float, default: 0.7)

pycolmap.estimate_calibrated_two_view_geometry(
camera1: pycolmap.Camera,
points1: numpy.ndarray[numpy.float64[m, 2]],
camera2: pycolmap.Camera,
points2: numpy.ndarray[numpy.float64[m, 2]],
matches: numpy.ndarray[numpy.uint32[m, 2]] = None,
options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
) pycolmap.TwoViewGeometry
pycolmap.estimate_two_view_geometry(
camera1: pycolmap.Camera,
points1: numpy.ndarray[numpy.float64[m, 2]],
camera2: pycolmap.Camera,
points2: numpy.ndarray[numpy.float64[m, 2]],
matches: numpy.ndarray[numpy.uint32[m, 2]] = None,
options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
) pycolmap.TwoViewGeometry
pycolmap.estimate_two_view_geometry_pose(
camera1: pycolmap.Camera,
points1: numpy.ndarray[numpy.float64[m, 2]],
camera2: pycolmap.Camera,
points2: numpy.ndarray[numpy.float64[m, 2]],
geometry: pycolmap.TwoViewGeometry,
) bool
pycolmap.squared_sampson_error(
points2D1: numpy.ndarray[numpy.float64[m, 2]],
points2D2: numpy.ndarray[numpy.float64[m, 2]],
E: numpy.ndarray[numpy.float64[3, 3]],
) list[float]

Calculate the squared Sampson error for a given essential or fundamental matrix.

class pycolmap.ImagePairStat
property num_total_corrs
property num_tri_corrs
class pycolmap.ObservationManager
add_observation(
self: pycolmap.ObservationManager,
point3D_id: int,
track_element: pycolmap.TrackElement,
) None

Add observation to existing 3D point.

add_point3D(
self: pycolmap.ObservationManager,
xyz: numpy.ndarray[numpy.float64[3, 1]],
track: pycolmap.Track,
color: numpy.ndarray[numpy.uint8[3, 1]] = array([0, 0, 0], dtype=uint8),
) int

Add new 3D object, and return its unique ID.

decrement_correspondence_has_point3D(
self: pycolmap.ObservationManager,
image_id: int,
point2D_idx: int,
) None

Indicate that another image has a point that is not triangulated any more and has a correspondence to this image point. This assumesthat IncrementCorrespondenceHasPoint3D was called for the sameimage point and correspondence before.

delete_observation(self: pycolmap.ObservationManager, image_id: int, point2D_idx: int) None

Delete one observation from an image and the corresponding 3D point. Note that this deletes the entire 3D point, if the track has two elements prior to calling this method.

delete_point3D(self: pycolmap.ObservationManager, point3D_id: int) None

Delete a 3D point, and all its references in the observed images.

deregister_image(self: pycolmap.ObservationManager, image_id: int) None

De-register an existing image, and all its references.

filter_all_points3D(
self: pycolmap.ObservationManager,
max_reproj_error: float,
min_tri_angle: float,
) int

Filter 3D points with large reprojection error, negative depth, orinsufficient triangulation angle. Return the number of filtered observations.

filter_images(
self: pycolmap.ObservationManager,
min_focal_length_ratio: float,
max_focal_length_ratio: float,
max_extra_param: float,
) list[int]

Filter images without observations or bogus camera parameters.Return the identifiers of the filtered images.

filter_observations_with_negative_depth(self: pycolmap.ObservationManager) int

Filter observations that have negative depth. Return the number of filtered observations.

filter_points3D(
self: pycolmap.ObservationManager,
max_reproj_error: float,
min_tri_angle: float,
point3D_ids: set[int],
) int

Filter 3D points with large reprojection error, negative depth, orinsufficient triangulation angle. Return the number of filtered observations.

filter_points3D_in_images(
self: pycolmap.ObservationManager,
max_reproj_error: float,
min_tri_angle: float,
image_ids: set[int],
) int

Filter 3D points with large reprojection error, negative depth, orinsufficient triangulation angle. Return the number of filtered observations.

property image_pairs
increment_correspondence_has_point3D(
self: pycolmap.ObservationManager,
image_id: int,
point2D_idx: int,
) None

Indicate that another image has a point that is triangulated and has a correspondence to this image point.

merge_points3D(self: pycolmap.ObservationManager, point3D_id1: int, point3D_id2: int) int

Merge two 3D points and return new identifier of new 3D point.The location of the merged 3D point is a weighted average of the two original 3D point’s locations according to their track lengths.

num_correspondences(self: pycolmap.ObservationManager, image_id: int) int

Number of correspondences for all image points.

num_observations(self: pycolmap.ObservationManager, image_id: int) int

Number of observations, i.e. the number of image points thathave at least one correspondence to another image.

num_visible_points3D(self: pycolmap.ObservationManager, image_id: int) int

Get the number of observations that see a triangulated point, i.e. the number of image points that have at least one correspondence toa triangulated point in another image.

point3D_visibility_score(self: pycolmap.ObservationManager, image_id: int) int

Get the score of triangulated observations. In contrast to`NumVisiblePoints3D`, this score also captures the distributionof triangulated observations in the image. This is useful to select the next best image in incremental reconstruction, because amore uniform distribution of observations results in more robust registration.

class pycolmap.IncrementalTriangulatorOptions
property complete_max_reproj_error

Maximum reprojection error to complete an existing triangulation. (float, default: 4.0)

property complete_max_transitivity

Maximum transitivity for track completion. (int, default: 5)

property continue_max_angle_error

Maximum angular error to continue existing triangulations. (float, default: 2.0)

property create_max_angle_error

Maximum angular error to create new triangulations. (float, default: 2.0)

property ignore_two_view_tracks

Whether to ignore two-view tracks. (bool, default: True)

property max_extra_param

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 1.0)

property max_focal_length_ratio

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 10.0)

property max_transitivity

Maximum transitivity to search for correspondences. (int, default: 1)

property merge_max_reproj_error

Maximum reprojection error in pixels to merge triangulations. (float, default: 4.0)

mergedict(self: object, arg0: dict) None
property min_angle

Minimum pairwise triangulation angle for a stable triangulation. (float, default: 1.5)

property min_focal_length_ratio

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 0.1)

property re_max_angle_error

Maximum angular error to re-triangulate under-reconstructed image pairs. (float, default: 5.0)

property re_max_trials

Maximum number of trials to re-triangulate an image pair. (int, default: 1)

property re_min_ratio

Minimum ratio of common triangulations between an image pair over the number of correspondences between that image pair to be considered as under-reconstructed. (float, default: 0.2)

summary(self: pycolmap.IncrementalTriangulatorOptions, write_type: bool = False) str
todict(self: pycolmap.IncrementalTriangulatorOptions, recursive: bool = True) dict
class pycolmap.IncrementalTriangulator
add_modified_point3D(self: pycolmap.IncrementalTriangulator, point3D_id: int) None
clear_modified_points3D(self: pycolmap.IncrementalTriangulator) None
complete_all_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
) int
complete_image(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
image_id: int,
) int
complete_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
point3D_ids: set[int],
) int
merge_all_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
) int
merge_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
point3D_ids: set[int],
) int
retriangulate(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
) int
triangulate_image(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
image_id: int,
) int
class pycolmap.ImageSelectionMethod

Members:

MAX_VISIBLE_POINTS_NUM

MAX_VISIBLE_POINTS_RATIO

MIN_UNCERTAINTY

MAX_VISIBLE_POINTS_NUM = <ImageSelectionMethod.MAX_VISIBLE_POINTS_NUM: 0>
MAX_VISIBLE_POINTS_RATIO = <ImageSelectionMethod.MAX_VISIBLE_POINTS_RATIO: 1>
MIN_UNCERTAINTY = <ImageSelectionMethod.MIN_UNCERTAINTY: 2>
property name
property value
class pycolmap.IncrementalMapperOptions
property abs_pose_max_error

Maximum reprojection error in absolute pose estimation. (float, default: 12.0)

property abs_pose_min_inlier_ratio

Minimum inlier ratio in absolute pose estimation. (float, default: 0.25)

property abs_pose_min_num_inliers

Minimum number of inliers in absolute pose estimation. (int, default: 30)

property abs_pose_refine_extra_params

Whether to estimate the extra parameters in absolute pose estimation. (bool, default: True)

property abs_pose_refine_focal_length

Whether to estimate the focal length in absolute pose estimation. (bool, default: True)

property filter_max_reproj_error

Maximum reprojection error in pixels for observations. (float, default: 4.0)

property filter_min_tri_angle

Minimum triangulation angle in degrees for stable 3D points. (float, default: 1.5)

property fix_existing_images

If reconstruction is provided as input, fix the existing image poses. (bool, default: False)

property image_selection_method

Method to find and select next best image to register. (ImageSelectionMethod, default: ImageSelectionMethod.MIN_UNCERTAINTY)

property init_max_error

Maximum error in pixels for two-view geometry estimation for initial image pair. (float, default: 4.0)

property init_max_forward_motion

Maximum forward motion for initial image pair. (float, default: 0.95)

property init_max_reg_trials

Maximum number of trials to use an image for initialization. (int, default: 2)

property init_min_num_inliers

Minimum number of inliers for initial image pair. (int, default: 100)

property init_min_tri_angle

Minimum triangulation angle for initial image pair. (float, default: 16.0)

property local_ba_min_tri_angle

Minimum triangulation for images to be chosen in local bundle adjustment. (float, default: 6.0)

property local_ba_num_images

Number of images to optimize in local bundle adjustment. (int, default: 6)

property max_extra_param

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 1.0)

property max_focal_length_ratio

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 10.0)

property max_reg_trials

Maximum number of trials to register an image. (int, default: 3)

mergedict(self: object, arg0: dict) None
property min_focal_length_ratio

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 0.1)

property num_threads

Number of threads. (int, default: -1)

summary(self: pycolmap.IncrementalMapperOptions, write_type: bool = False) str
todict(self: pycolmap.IncrementalMapperOptions, recursive: bool = True) dict
class pycolmap.LocalBundleAdjustmentReport
mergedict(self: object, arg0: dict) None
property num_adjusted_observations

(int, default: 0)

property num_completed_observations

(int, default: 0)

property num_filtered_observations

(int, default: 0)

property num_merged_observations

(int, default: 0)

summary(self: pycolmap.LocalBundleAdjustmentReport, write_type: bool = False) str
todict(self: pycolmap.LocalBundleAdjustmentReport, recursive: bool = True) dict
class pycolmap.IncrementalMapper
adjust_global_bundle(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
) bool
adjust_local_bundle(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
tri_options: pycolmap.IncrementalTriangulatorOptions,
image_id: int,
point3D_ids: set[int],
) pycolmap.LocalBundleAdjustmentReport
begin_reconstruction(
self: pycolmap.IncrementalMapper,
reconstruction: pycolmap.Reconstruction,
) None
clear_modified_points3D(self: pycolmap.IncrementalMapper) None
complete_and_merge_tracks(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int
complete_tracks(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int
end_reconstruction(self: pycolmap.IncrementalMapper, discard: bool) None
estimate_initial_two_view_geometry(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id1: int,
image_id2: int,
) pycolmap.TwoViewGeometry | None
property existing_image_ids
filter_images(self: pycolmap.IncrementalMapper, options: pycolmap.IncrementalMapperOptions) int
filter_points(self: pycolmap.IncrementalMapper, options: pycolmap.IncrementalMapperOptions) int
property filtered_images
find_initial_image_pair(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id1: int,
image_id2: int,
) tuple[int, int] | None
find_local_bundle(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id: int,
) list[int]
find_next_images(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
) list[int]
get_modified_points3D(self: pycolmap.IncrementalMapper) set[int]
iterative_global_refinement(
self: pycolmap.IncrementalMapper,
max_num_refinements: int,
max_refinement_change: float,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
tri_options: pycolmap.IncrementalTriangulatorOptions,
normalize_reconstruction: bool = True,
) None
iterative_local_refinement(
self: pycolmap.IncrementalMapper,
max_num_refinements: int,
max_refinement_change: float,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
tri_options: pycolmap.IncrementalTriangulatorOptions,
image_id: int,
) None
merge_tracks(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int
property num_reg_images_per_camera
num_shared_reg_images(self: pycolmap.IncrementalMapper) int
num_total_reg_images(self: pycolmap.IncrementalMapper) int
property observation_manager
property reconstruction
register_initial_image_pair(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
two_view_geometry: pycolmap.TwoViewGeometry,
image_id1: int,
image_id2: int,
) None
register_next_image(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id: int,
) bool
retriangulate(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int
triangulate_image(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
image_id: int,
) int
property triangulator
class pycolmap.IncrementalPipelineOptions
property ba_global_function_tolerance

Ceres solver function tolerance for global bundle adjustment. (float, default: 0.0)

property ba_global_images_freq

The growth rates after which to perform global bundle adjustment. (int, default: 500)

property ba_global_images_ratio

The growth rates after which to perform global bundle adjustment. (float, default: 1.1)

property ba_global_max_num_iterations

The maximum number of global bundle adjustment iterations. (int, default: 50)

property ba_global_max_refinement_change

The thresholds for iterative bundle adjustment refinements. (float, default: 0.0005)

property ba_global_max_refinements

The thresholds for iterative bundle adjustment refinements. (int, default: 5)

property ba_global_points_freq

The growth rates after which to perform global bundle adjustment. (int, default: 250000)

property ba_global_points_ratio

The growth rates after which to perform global bundle adjustment. (float, default: 1.1)

property ba_local_function_tolerance

Ceres solver function tolerance for local bundle adjustment. (float, default: 0.0)

property ba_local_max_num_iterations

The maximum number of local bundle adjustment iterations. (int, default: 25)

property ba_local_max_refinement_change

The thresholds for iterative bundle adjustment refinements. (float, default: 0.001)

property ba_local_max_refinements

The thresholds for iterative bundle adjustment refinements. (int, default: 2)

property ba_local_num_images

The number of images to optimize in local bundle adjustment. (int, default: 6)

property ba_min_num_residuals_for_cpu_multi_threading

The minimum number of residuals per bundle adjustment problem to enable multi-threading solving of the problems. (int, default: 50000)

property ba_refine_extra_params

Which intrinsic parameters to optimize during the reconstruction. (bool, default: True)

property ba_refine_focal_length

Which intrinsic parameters to optimize during the reconstruction. (bool, default: True)

property ba_refine_principal_point

Which intrinsic parameters to optimize during the reconstruction. (bool, default: False)

property extract_colors

Whether to extract colors for reconstructed points. (bool, default: True)

property fix_existing_images

If reconstruction is provided as input, fix the existing image poses. (bool, default: False)

get_global_bundle_adjustment(
self: pycolmap.IncrementalPipelineOptions,
) pycolmap.BundleAdjustmentOptions
get_local_bundle_adjustment(
self: pycolmap.IncrementalPipelineOptions,
) pycolmap.BundleAdjustmentOptions
get_mapper(self: pycolmap.IncrementalPipelineOptions) pycolmap.IncrementalMapperOptions
get_triangulation(
self: pycolmap.IncrementalPipelineOptions,
) pycolmap.IncrementalTriangulatorOptions
property ignore_watermarks

Whether to ignore the inlier matches of watermark image pairs. (bool, default: False)

property image_names

Which images to reconstruct. If no images are specified, all images will be reconstructed by default. (set, default: set())

property init_image_id1

The image identifier of the first image used to initialize the reconstruction. (int, default: -1)

property init_image_id2

The image identifier of the second image used to initialize the reconstruction. Determined automatically if left unspecified. (int, default: -1)

property init_num_trials

The number of trials to initialize the reconstruction. (int, default: 200)

is_initial_pair_provided(self: pycolmap.IncrementalPipelineOptions) bool
property mapper

Options of the IncrementalMapper. (IncrementalMapperOptions, default: IncrementalMapperOptions(init_min_num_inliers=100, init_max_error=4.0, init_max_forward_motion=0.95, init_min_tri_angle=16.0, init_max_reg_trials=2, abs_pose_max_error=12.0, abs_pose_min_num_inliers=30, abs_pose_min_inlier_ratio=0.25, abs_pose_refine_focal_length=True, abs_pose_refine_extra_params=True, local_ba_num_images=6, local_ba_min_tri_angle=6.0, min_focal_length_ratio=0.1, max_focal_length_ratio=10.0, max_extra_param=1.0, filter_max_reproj_error=4.0, filter_min_tri_angle=1.5, max_reg_trials=3, fix_existing_images=False, num_threads=-1, image_selection_method=ImageSelectionMethod.MIN_UNCERTAINTY))

property max_extra_param

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 1.0)

property max_focal_length_ratio

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 10.0)

property max_model_overlap

The maximum number of overlapping images between sub-models. If the current sub-models shares more than this number of images with another model, then the reconstruction is stopped. (int, default: 20)

property max_num_models

The number of sub-models to reconstruct. (int, default: 50)

mergedict(self: object, arg0: dict) None
property min_focal_length_ratio

The threshold used to filter and ignore images with degenerate intrinsics. (float, default: 0.1)

property min_model_size

The minimum number of registered images of a sub-model, otherwise the sub-model is discarded. Note that the first sub-model is always kept independent of size. (int, default: 10)

property min_num_matches

The minimum number of matches for inlier matches to be considered. (int, default: 15)

property multiple_models

Whether to reconstruct multiple sub-models. (bool, default: True)

property num_threads

The number of threads to use during reconstruction. (int, default: -1)

property snapshot_images_freq

Frequency of registered images according to which reconstruction snapshots will be saved. (int, default: 0)

property snapshot_path

Path to a folder in which reconstruction snapshots will be saved during incremental reconstruction. (str, default: )

summary(self: pycolmap.IncrementalPipelineOptions, write_type: bool = False) str
todict(self: pycolmap.IncrementalPipelineOptions, recursive: bool = True) dict
property triangulation

Options of the IncrementalTriangulator. (IncrementalTriangulatorOptions, default: IncrementalTriangulatorOptions(max_transitivity=1, create_max_angle_error=2.0, continue_max_angle_error=2.0, merge_max_reproj_error=4.0, complete_max_reproj_error=4.0, complete_max_transitivity=5, re_max_angle_error=5.0, re_min_ratio=0.2, re_max_trials=1, min_angle=1.5, ignore_two_view_tracks=True, min_focal_length_ratio=0.1, max_focal_length_ratio=10.0, max_extra_param=1.0))

class pycolmap.IncrementalMapperCallback

Members:

INITIAL_IMAGE_PAIR_REG_CALLBACK

NEXT_IMAGE_REG_CALLBACK

LAST_IMAGE_REG_CALLBACK

INITIAL_IMAGE_PAIR_REG_CALLBACK = <IncrementalMapperCallback.INITIAL_IMAGE_PAIR_REG_CALLBACK: 0>
LAST_IMAGE_REG_CALLBACK = <IncrementalMapperCallback.LAST_IMAGE_REG_CALLBACK: 2>
NEXT_IMAGE_REG_CALLBACK = <IncrementalMapperCallback.NEXT_IMAGE_REG_CALLBACK: 1>
property name
property value
class pycolmap.IncrementalMapperStatus

Members:

NO_INITIAL_PAIR

BAD_INITIAL_PAIR

SUCCESS

INTERRUPTED

BAD_INITIAL_PAIR = <IncrementalMapperStatus.BAD_INITIAL_PAIR: 1>
INTERRUPTED = <IncrementalMapperStatus.INTERRUPTED: 3>
NO_INITIAL_PAIR = <IncrementalMapperStatus.NO_INITIAL_PAIR: 0>
SUCCESS = <IncrementalMapperStatus.SUCCESS: 2>
property name
property value
class pycolmap.IncrementalPipeline
add_callback(self: pycolmap.IncrementalPipeline, id: int, func: Callable[[], None]) None
callback(self: pycolmap.IncrementalPipeline, id: int) None
check_run_global_refinement(
self: pycolmap.IncrementalPipeline,
reconstruction: pycolmap.Reconstruction,
ba_prev_num_reg_images: int,
ba_prev_num_points: int,
) bool
property database_cache
property database_path
property image_path
initialize_reconstruction(
self: pycolmap.IncrementalPipeline,
core_mapper: pycolmap.IncrementalMapper,
mapper_options: pycolmap.IncrementalMapperOptions,
reconstruction: pycolmap.Reconstruction,
) pycolmap.IncrementalMapperStatus
load_database(self: pycolmap.IncrementalPipeline) bool
property options
reconstruct(
self: pycolmap.IncrementalPipeline,
mapper_options: pycolmap.IncrementalMapperOptions,
) None
reconstruct_sub_model(
self: pycolmap.IncrementalPipeline,
core_mapper: pycolmap.IncrementalMapper,
mapper_options: pycolmap.IncrementalMapperOptions,
reconstruction: pycolmap.Reconstruction,
) pycolmap.IncrementalMapperStatus
property reconstruction_manager
run(self: pycolmap.IncrementalPipeline) None
class pycolmap.Normalization

Members:

L1_ROOT : L1-normalizes each descriptor followed by element-wise square rooting. This normalization is usually better than standard L2-normalization. See ‘Three things everyone should know to improve object retrieval’, Relja Arandjelovic and Andrew Zisserman, CVPR 2012.

L2 : Each vector is L2-normalized.

L1_ROOT = <Normalization.L1_ROOT: 0>
L2 = <Normalization.L2: 1>
property name
property value
class pycolmap.SiftExtractionOptions
property darkness_adaptivity

Whether to adapt the feature detection depending on the image darkness. only available on GPU. (bool, default: False)

property domain_size_pooling

“Domain-Size Pooling in Local Descriptors and NetworkArchitectures”, J. Dong and S. Soatto, CVPR 2015 (bool, default: False)

property dsp_max_scale

(float, default: 3.0)

property dsp_min_scale

(float, default: 0.16666666666666666)

property dsp_num_scales

(int, default: 10)

property edge_threshold

Edge threshold for detection. (float, default: 10.0)

property estimate_affine_shape

Estimate affine shape of SIFT features in the form of oriented ellipses as opposed to original SIFT which estimates oriented disks. (bool, default: False)

property first_octave

First octave in the pyramid, i.e. -1 upsamples the image by one level. (int, default: -1)

property gpu_index

Index of the GPU used for feature matching. For multi-GPU matching, you should separate multiple GPU indices by comma, e.g., ‘0,1,2,3’. (str, default: -1)

property max_image_size

Maximum image size, otherwise image will be down-scaled. (int, default: 3200)

property max_num_features

Maximum number of features to detect, keeping larger-scale features. (int, default: 8192)

property max_num_orientations

Maximum number of orientations per keypoint if not estimate_affine_shape. (int, default: 2)

mergedict(self: object, arg0: dict) None
property normalization

L1_ROOT or L2 descriptor normalization (Normalization, default: Normalization.L1_ROOT)

property num_octaves

(int, default: 4)

property num_threads

Number of threads for feature matching and geometric verification. (int, default: -1)

property octave_resolution

Number of levels per octave. (int, default: 3)

property peak_threshold

Peak threshold for detection. (float, default: 0.006666666666666667)

summary(self: pycolmap.SiftExtractionOptions, write_type: bool = False) str
todict(self: pycolmap.SiftExtractionOptions, recursive: bool = True) dict
property upright

Fix the orientation to 0 for upright features (bool, default: False)

class pycolmap.Sift
property device
extract(*args, **kwargs)

Overloaded function.

  1. extract(self: pycolmap.Sift, image: numpy.ndarray[numpy.uint8[m, n], flags.c_contiguous]) -> tuple[numpy.ndarray[numpy.float32[m, 4]], numpy.ndarray[numpy.float32[m, n]]]

  2. extract(self: pycolmap.Sift, image: numpy.ndarray[numpy.float32[m, n], flags.c_contiguous]) -> tuple[numpy.ndarray[numpy.float32[m, 4]], numpy.ndarray[numpy.float32[m, n]]]

property options
class pycolmap.CameraMode

Members:

AUTO

SINGLE

PER_FOLDER

PER_IMAGE

AUTO = <CameraMode.AUTO: 0>
PER_FOLDER = <CameraMode.PER_FOLDER: 2>
PER_IMAGE = <CameraMode.PER_IMAGE: 3>
SINGLE = <CameraMode.SINGLE: 1>
property name
property value
class pycolmap.ImageReaderOptions
property camera_mask_path

Optional path to an image file specifying a mask for all images. No features will be extracted in regions where the mask is black (pixel intensity value 0 in grayscale) (str, default: )

property camera_model

Name of the camera model. (str, default: SIMPLE_RADIAL)

property camera_params

Manual specification of camera parameters. If empty, camera parameters will be extracted from EXIF, i.e. principal point and focal length. (str, default: )

property default_focal_length_factor

If camera parameters are not specified manually and the image does not have focal length EXIF information, the focal length is set to the value default_focal_length_factor * max(width, height). (float, default: 1.2)

property existing_camera_id

Whether to explicitly use an existing camera for all images. Note that in this case the specified camera model and parameters are ignored. (int, default: -1)

property mask_path

Optional root path to folder which contains imagemasks. For a given image, the corresponding maskmust have the same sub-path below this root as theimage has below image_path. The filename must beequal, aside from the added extension .png. For example, for an image image_path/abc/012.jpg,the mask would be mask_path/abc/012.jpg.png. Nofeatures will be extracted in regions where themask image is black (pixel intensity value 0 ingrayscale). (str, default: )

mergedict(self: object, arg0: dict) None
summary(self: pycolmap.ImageReaderOptions, write_type: bool = False) str
todict(self: pycolmap.ImageReaderOptions, recursive: bool = True) dict
class pycolmap.CopyType

Members:

copy

softlink

hardlink

copy = <CopyType.copy: 0>
property name
property value
class pycolmap.UndistortCameraOptions
property blank_pixels

The amount of blank pixels in the undistorted image in the range [0, 1]. (float, default: 0.0)

property max_image_size

Maximum image size in terms of width or height of the undistorted camera. (int, default: -1)

property max_scale

Maximum scale change of camera used to satisfy the blank pixel constraint. (float, default: 2.0)

mergedict(self: object, arg0: dict) None
property min_scale

Minimum scale change of camera used to satisfy the blank pixel constraint. (float, default: 0.2)

property roi_max_x

(float, default: 1.0)

property roi_max_y

(float, default: 1.0)

property roi_min_x

(float, default: 0.0)

property roi_min_y

(float, default: 0.0)

summary(self: pycolmap.UndistortCameraOptions, write_type: bool = False) str
todict(self: pycolmap.UndistortCameraOptions, recursive: bool = True) dict
pycolmap.import_images(
database_path: str,
image_path: str,
camera_mode: pycolmap.CameraMode = <CameraMode.AUTO: 0>,
image_list: list[str] = [],
options: pycolmap.ImageReaderOptions = ImageReaderOptions(),
) None

Import images into a database

pycolmap.infer_camera_from_image(image_path: str, options: pycolmap.ImageReaderOptions = ImageReaderOptions()) pycolmap.Camera

Guess the camera parameters from the EXIF metadata

pycolmap.undistort_images(
output_path: str,
input_path: str,
image_path: str,
image_list: list[str] = [],
output_type: str = 'COLMAP',
copy_policy: pycolmap.CopyType = <CopyType.copy: 0>,
num_patch_match_src_images: int = 20,
undistort_options: pycolmap.UndistortCameraOptions = UndistortCameraOptions(),
) None

Undistort images

pycolmap.extract_features(
database_path: str,
image_path: str,
image_list: list[str] = [],
camera_mode: pycolmap.CameraMode = <CameraMode.AUTO: 0>,
camera_model: str = 'SIMPLE_RADIAL',
reader_options: pycolmap.ImageReaderOptions = ImageReaderOptions(),
sift_options: pycolmap.SiftExtractionOptions = SiftExtractionOptions(),
device: pycolmap.Device = <Device.auto: -1>,
) None

Extract SIFT Features and write them to database

class pycolmap.SiftMatchingOptions
property cross_check

Whether to enable cross checking in matching. (bool, default: True)

property gpu_index

Index of the GPU used for feature matching. For multi-GPU matching, you should separate multiple GPU indices by comma, e.g., “0,1,2,3”. (str, default: -1)

property guided_matching

Whether to perform guided matching, if geometric verification succeeds. (bool, default: False)

property max_distance

Maximum distance to best match. (float, default: 0.7)

property max_num_matches

Maximum number of matches. (int, default: 32768)

property max_ratio

Maximum distance ratio between first and second best match. (float, default: 0.8)

mergedict(self: object, arg0: dict) None
property num_threads

(int, default: -1)

summary(self: pycolmap.SiftMatchingOptions, write_type: bool = False) str
todict(self: pycolmap.SiftMatchingOptions, recursive: bool = True) dict
class pycolmap.ExhaustiveMatchingOptions
property block_size

(int, default: 50)

mergedict(self: object, arg0: dict) None
summary(self: pycolmap.ExhaustiveMatchingOptions, write_type: bool = False) str
todict(self: pycolmap.ExhaustiveMatchingOptions, recursive: bool = True) dict
class pycolmap.SpatialMatchingOptions
property ignore_z

Whether to ignore the Z-component of the location prior. (bool, default: True)

property max_distance

The maximum distance between the query and nearest neighbor [meters]. (float, default: 100.0)

property max_num_neighbors

The maximum number of nearest neighbors to match. (int, default: 50)

mergedict(self: object, arg0: dict) None
property num_threads

(int, default: -1)

summary(self: pycolmap.SpatialMatchingOptions, write_type: bool = False) str
todict(self: pycolmap.SpatialMatchingOptions, recursive: bool = True) dict
class pycolmap.VocabTreeMatchingOptions
check(self: pycolmap.VocabTreeMatchingOptions) None
property match_list_path

Optional path to file with specific image names to match. (str, default: )

property max_num_features

The maximum number of features to use for indexing an image. (int, default: -1)

mergedict(self: object, arg0: dict) None
property num_checks

Number of nearest-neighbor checks to use in retrieval. (int, default: 256)

property num_images

Number of images to retrieve for each query image. (int, default: 100)

property num_images_after_verification

How many images to return after spatial verification. Set to 0 to turn off spatial verification. (int, default: 0)

property num_nearest_neighbors

Number of nearest neighbors to retrieve per query feature. (int, default: 5)

property num_threads

(int, default: -1)

summary(self: pycolmap.VocabTreeMatchingOptions, write_type: bool = False) str
todict(self: pycolmap.VocabTreeMatchingOptions, recursive: bool = True) dict
property vocab_tree_path

Path to the vocabulary tree. (str, default: )

class pycolmap.SequentialMatchingOptions
property loop_detection

Loop detection is invoked every loop_detection_period images. (bool, default: False)

property loop_detection_max_num_features

The maximum number of features to use for indexing an image. If an image has more features, only the largest-scale features will be indexed. (int, default: -1)

property loop_detection_num_checks

Number of nearest-neighbor checks to use in retrieval. (int, default: 256)

property loop_detection_num_images

The number of images to retrieve in loop detection. This number should be significantly bigger than the sequential matching overlap. (int, default: 50)

property loop_detection_num_images_after_verification

How many images to return after spatial verification. Set to 0 to turn off spatial verification. (int, default: 0)

property loop_detection_num_nearest_neighbors

Number of nearest neighbors to retrieve per query feature. (int, default: 1)

mergedict(self: object, arg0: dict) None
property overlap

Number of overlapping image pairs. (int, default: 10)

property quadratic_overlap

Whether to match images against their quadratic neighbors. (bool, default: True)

summary(self: pycolmap.SequentialMatchingOptions, write_type: bool = False) str
todict(self: pycolmap.SequentialMatchingOptions, recursive: bool = True) dict
vocab_tree_options(
self: pycolmap.SequentialMatchingOptions,
) pycolmap.VocabTreeMatchingOptions
property vocab_tree_path

Path to the vocabulary tree. (str, default: )

class pycolmap.ImagePairsMatchingOptions
property block_size

Number of image pairs to match in one batch. (int, default: 1225)

property match_list_path

Path to the file with the matches. (str, default: )

mergedict(self: object, arg0: dict) None
summary(self: pycolmap.ImagePairsMatchingOptions, write_type: bool = False) str
todict(self: pycolmap.ImagePairsMatchingOptions, recursive: bool = True) dict
pycolmap.match_exhaustive(
database_path: str,
sift_options: pycolmap.SiftMatchingOptions = SiftMatchingOptions(),
matching_options: pycolmap.ExhaustiveMatchingOptions = ExhaustiveMatchingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = <Device.auto: -1>,
) None

Exhaustive feature matching

pycolmap.match_spatial(
database_path: str,
sift_options: pycolmap.SiftMatchingOptions = SiftMatchingOptions(),
matching_options: pycolmap.SpatialMatchingOptions = SpatialMatchingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = <Device.auto: -1>,
) None

Spatial feature matching

pycolmap.match_vocabtree(
database_path: str,
sift_options: pycolmap.SiftMatchingOptions = SiftMatchingOptions(),
matching_options: pycolmap.VocabTreeMatchingOptions = VocabTreeMatchingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = <Device.auto: -1>,
) None

Vocab tree feature matching

pycolmap.match_sequential(
database_path: str,
sift_options: pycolmap.SiftMatchingOptions = SiftMatchingOptions(),
matching_options: pycolmap.SequentialMatchingOptions = SequentialMatchingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = <Device.auto: -1>,
) None

Sequential feature matching

pycolmap.verify_matches(
database_path: str,
pairs_path: str,
options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
) None

Run geometric verification of the matches

class pycolmap.PairGenerator
all_pairs(self: pycolmap.PairGenerator) list[tuple[int, int]]
has_finished(self: pycolmap.PairGenerator) bool
next(self: pycolmap.PairGenerator) list[tuple[int, int]]
reset(self: pycolmap.PairGenerator) None
class pycolmap.ExhaustivePairGenerator
class pycolmap.VocabTreePairGenerator
class pycolmap.SequentialPairGenerator
class pycolmap.SpatialPairGenerator
class pycolmap.ImportedPairGenerator
pycolmap.triangulate_points(
reconstruction: pycolmap.Reconstruction,
database_path: str,
image_path: str,
output_path: str,
clear_points: bool = True,
options: pycolmap.IncrementalPipelineOptions = IncrementalPipelineOptions(),
refine_intrinsics: bool = False,
) pycolmap.Reconstruction

Triangulate 3D points from known camera poses

pycolmap.incremental_mapping(
database_path: str,
image_path: str,
output_path: str,
options: pycolmap.IncrementalPipelineOptions = IncrementalPipelineOptions(),
input_path: str = '',
initial_image_pair_callback: Callable[[], None] = None,
next_image_callback: Callable[[], None] = None,
) dict[int, pycolmap.Reconstruction]

Recover 3D points and unknown camera poses

pycolmap.bundle_adjustment(
reconstruction: pycolmap.Reconstruction,
options: pycolmap.BundleAdjustmentOptions = BundleAdjustmentOptions(),
) None

Jointly refine 3D points and camera poses

class pycolmap.PatchMatchOptions
property allow_missing_files

Whether to tolerate missing images/maps in the problem setup (bool, default: False)

property cache_size

Cache size in gigabytes for patch match. (float, default: 32.0)

property depth_max

(float, default: -1.0)

property depth_min

(float, default: -1.0)

property filter

Whether to enable filtering. (bool, default: True)

property filter_geom_consistency_max_cost

Maximum forward-backward reprojection error for pixel to be geometrically consistent. (float, default: 1.0)

property filter_min_ncc

Minimum NCC coefficient for pixel to be photo-consistent. (float, default: 0.10000000149011612)

property filter_min_num_consistent

Minimum number of source images have to be consistent for pixel not to be filtered. (int, default: 2)

property filter_min_triangulation_angle

Minimum triangulation angle to be stable. (float, default: 3.0)

property geom_consistency

Whether to add a regularized geometric consistency term to the cost function. If true, the depth_maps and normal_maps must not be null. (bool, default: True)

property geom_consistency_max_cost

Maximum geometric consistency cost in terms of the forward-backward reprojection error in pixels. (float, default: 3.0)

property geom_consistency_regularizer

The relative weight of the geometric consistency term w.r.t. to the photo-consistency term. (float, default: 0.30000001192092896)

property gpu_index

Index of the GPU used for patch match. For multi-GPU usage, you should separate multiple GPU indices by comma, e.g., “0,1,2,3”. (str, default: -1)

property incident_angle_sigma

Spread of the incident angle likelihood function. (float, default: 0.8999999761581421)

property max_image_size

Maximum image size in either dimension. (int, default: -1)

mergedict(self: object, arg0: dict) None
property min_triangulation_angle

Minimum triangulation angle in degrees. (float, default: 1.0)

property ncc_sigma

Spread of the NCC likelihood function. (float, default: 0.6000000238418579)

property num_iterations

Number of coordinate descent iterations. (int, default: 5)

property num_samples

Number of random samples to draw in Monte Carlo sampling. (int, default: 15)

property sigma_color

Color sigma for bilaterally weighted NCC. (float, default: 0.20000000298023224)

property sigma_spatial

Spatial sigma for bilaterally weighted NCC. (float, default: -1.0)

summary(self: pycolmap.PatchMatchOptions, write_type: bool = False) str
todict(self: pycolmap.PatchMatchOptions, recursive: bool = True) dict
property window_radius

Half window size to compute NCC photo-consistency cost. (int, default: 5)

property window_step

Number of pixels to skip when computing NCC. (int, default: 1)

property write_consistency_graph

Whether to write the consistency graph. (bool, default: False)

pycolmap.patch_match_stereo(
workspace_path: str,
workspace_format: str = 'COLMAP',
pmvs_option_name: str = 'option-all',
options: pycolmap.PatchMatchOptions = PatchMatchOptions(),
config_path: str = '',
) None

Runs Patch-Match-Stereo (requires CUDA)

class pycolmap.StereoFusionOptions
property bounding_box

Bounding box Tuple[min, max] (tuple, default: (array([-3.4028235e+38, -3.4028235e+38, -3.4028235e+38], dtype=float32), array([3.4028235e+38, 3.4028235e+38, 3.4028235e+38], dtype=float32)))

property cache_size

Cache size in gigabytes for fusion. (float, default: 32.0)

property check_num_images

Number of overlapping images to transitively check for fusing points. (int, default: 50)

property mask_path

Path for PNG masks. Same format expected as ImageReaderOptions. (str, default: )

property max_depth_error

Maximum relative difference between measured and projected depth. (float, default: 0.009999999776482582)

property max_image_size

Maximum image size in either dimension. (int, default: -1)

property max_normal_error

Maximum angular difference in degrees of normals of pixels to be fused. (float, default: 10.0)

property max_num_pixels

Maximum number of pixels to fuse into a single point. (int, default: 10000)

property max_reproj_error

Maximum relative difference between measured and projected pixel. (float, default: 2.0)

property max_traversal_depth

Maximum depth in consistency graph traversal. (int, default: 100)

mergedict(self: object, arg0: dict) None
property min_num_pixels

Minimum number of fused pixels to produce a point. (int, default: 5)

property num_threads

The number of threads to use during fusion. (int, default: -1)

summary(self: pycolmap.StereoFusionOptions, write_type: bool = False) str
todict(self: pycolmap.StereoFusionOptions, recursive: bool = True) dict
property use_cache

Flag indicating whether to use LRU cache or pre-load all data (bool, default: False)

pycolmap.stereo_fusion(
output_path: str,
workspace_path: str,
workspace_format: str = 'COLMAP',
pmvs_option_name: str = 'option-all',
input_type: str = 'geometric',
options: pycolmap.StereoFusionOptions = StereoFusionOptions(),
) pycolmap.Reconstruction

Stereo Fusion

class pycolmap.PoissonMeshingOptions
property color

If specified, the reconstruction code assumes that the input is equippedwith colors and will extrapolate the color values to the vertices of thereconstructed mesh. The floating point value specifies the relativeimportance of finer color estimates over lower ones. (float, default: 32.0)

property depth

This integer is the maximum depth of the tree that will be used for surfacereconstruction. Running at depth d corresponds to solving on a voxel gridwhose resolution is no larger than 2^d x 2^d x 2^d. Note that since thereconstructor adapts the octree to the sampling density, the specifiedreconstruction depth is only an upper bound. (int, default: 13)

mergedict(self: object, arg0: dict) None
property num_threads

The number of threads used for the Poisson reconstruction. (int, default: -1)

property point_weight

This floating point value specifies the importance that interpolation ofthe point samples is given in the formulation of the screened Poissonequation. The results of the original (unscreened) Poisson Reconstructioncan be obtained by setting this value to 0. (float, default: 1.0)

summary(self: pycolmap.PoissonMeshingOptions, write_type: bool = False) str
todict(self: pycolmap.PoissonMeshingOptions, recursive: bool = True) dict
property trim

This floating point values specifies the value for mesh trimming. Thesubset of the mesh with signal value less than the trim value is discarded. (float, default: 10.0)

class pycolmap.DelaunayMeshingOptions
property distance_sigma_factor

The factor that is applied to the computed distance sigma, which isautomatically computed as the 25th percentile of edge lengths. A highervalue will increase the smoothness of the surface. (float, default: 1.0)

property max_depth_dist

Maximum relative depth difference between input point and a vertex of anexisting cell in the Delaunay triangulation, otherwise a new vertex iscreated in the triangulation. (float, default: 0.05)

property max_proj_dist

Unify input points into one cell in the Delaunay triangulation that fallwithin a reprojected radius of the given pixels. (float, default: 20.0)

property max_side_length_factor

Filtering thresholds for outlier surface mesh faces. If the longest side ofa mesh face (longest out of 3) exceeds the side lengths of all faces at acertain percentile by the given factor, then it is considered an outliermesh face and discarded. (float, default: 25.0)

property max_side_length_percentile

Filtering thresholds for outlier surface mesh faces. If the longest side ofa mesh face (longest out of 3) exceeds the side lengths of all faces at acertain percentile by the given factor, then it is considered an outliermesh face and discarded. (float, default: 95.0)

mergedict(self: object, arg0: dict) None
property num_threads

The number of threads to use for reconstruction. Default is all threads. (int, default: -1)

property quality_regularization

A higher quality regularization leads to a smoother surface. (float, default: 1.0)

summary(self: pycolmap.DelaunayMeshingOptions, write_type: bool = False) str
todict(self: pycolmap.DelaunayMeshingOptions, recursive: bool = True) dict
property visibility_sigma

The standard deviation of wrt. the number of images seen by each point.Increasing this value decreases the influence of points seen in few images. (float, default: 3.0)

pycolmap.poisson_meshing(
input_path: str,
output_path: str,
options: pycolmap.PoissonMeshingOptions = PoissonMeshingOptions(),
) None

Perform Poisson surface reconstruction and return true if successful.

pycolmap.set_random_seed(seed: int) None

Initialize the PRNG with the given seed.

class pycolmap.ostream