pycolmap#

class pycolmap.Device(*args, **kwargs)#

Members:

auto

cpu

cuda

Overloaded function.

  1. __init__(self: pycolmap.Device, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.Device, name: str) None

property name#
property value#
auto = Device.auto#
cpu = Device.cpu#
cuda = Device.cuda#
class pycolmap.SensorType(*args, **kwargs)#

Members:

INVALID

CAMERA

IMU

Overloaded function.

  1. __init__(self: pycolmap.SensorType, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.SensorType, name: str) None

property name#
property value#
INVALID = SensorType.INVALID#
CAMERA = SensorType.CAMERA#
IMU = SensorType.IMU#
class pycolmap.sensor_t(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.sensor_t) None

  2. __init__(self: pycolmap.sensor_t, type: pycolmap.SensorType, id: typing.SupportsInt | typing.SupportsIndex) None

  3. __init__(self: pycolmap.sensor_t, arg0: dict) None

  4. __init__(self: pycolmap.sensor_t, **kwargs) None

property type#

(SensorType, default: SensorType.INVALID)

property id#

(int, default: 4294967295)

summary(self: pycolmap.sensor_t, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.sensor_t, recursive: bool = True) dict#
class pycolmap.data_t(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.data_t) None

  2. __init__(self: pycolmap.data_t, sensor_id: pycolmap.sensor_t, id: typing.SupportsInt | typing.SupportsIndex) None

  3. __init__(self: pycolmap.data_t, arg0: dict) None

  4. __init__(self: pycolmap.data_t, **kwargs) None

property sensor_id#

(sensor_t, default: sensor_t(type=SensorType.INVALID, id=4294967295))

property id#

(int, default: 4294967295)

summary(self: pycolmap.data_t, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.data_t, recursive: bool = True) dict#
pycolmap.image_pair_to_pair_id(
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) int#
pycolmap.pair_id_to_image_pair(pair_id: SupportsInt | SupportsIndex) tuple[int, int]#
pycolmap.should_swap_image_pair(
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) bool#
pycolmap.seconds_from_timestamp(t: SupportsInt | SupportsIndex) float#
pycolmap.timestamp_from_seconds(s: SupportsFloat | SupportsIndex) int#
pycolmap.timestamp_diff_seconds(
t1: SupportsInt | SupportsIndex,
t0: SupportsInt | SupportsIndex,
) float#
class pycolmap.logging#
class Level(self: pycolmap.logging.Level, value: SupportsInt | SupportsIndex)#

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#
INFO = <Level.INFO: 0>#
WARNING = <Level.WARNING: 1>#
ERROR = <Level.ERROR: 2>#
FATAL = <Level.FATAL: 3>#
minloglevel = 0#
stderrthreshold = 2#
log_dir = ''#
logtostderr = False#
alsologtostderr = True#
verbose_level = 0#
static set_log_destination(level: pycolmap.logging.Level, path: os.PathLike | str | bytes) None#
static verbose(level: SupportsInt | SupportsIndex, message: str) None#
static info(message: str) None#
static warning(message: str) None#
static error(message: str) None#
static fatal(message: str) None#
logtostdout = False#
colorlogtostdout = False#
colorlogtostderr = False#
class pycolmap.Timer(self: pycolmap.Timer)#
start(self: pycolmap.Timer) None#
restart(self: pycolmap.Timer) None#
pause(self: pycolmap.Timer) None#
resume(self: pycolmap.Timer) None#
reset(self: pycolmap.Timer) None#
elapsed_micro_seconds(self: pycolmap.Timer) float#
elapsed_seconds(self: pycolmap.Timer) float#
elapsed_minutes(self: pycolmap.Timer) float#
elapsed_hours(self: pycolmap.Timer) float#
print_seconds(self: pycolmap.Timer) None#
print_minutes(self: pycolmap.Timer) None#
print_hours(self: pycolmap.Timer) None#
class pycolmap.Rotation3d(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Rotation3d) None

  2. __init__(self: pycolmap.Rotation3d, xyzw: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[4, 1]"]) None

Quaternion in [x,y,z,w] format.

  1. __init__(self: pycolmap.Rotation3d, matrix: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 3]"]) None

3x3 rotation matrix.

  1. __init__(self: pycolmap.Rotation3d, axis_angle: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"]) None

Axis-angle 3D vector.

  1. __init__(self: pycolmap.Rotation3d, arg0: dict) None

  2. __init__(self: pycolmap.Rotation3d, **kwargs) None

static from_buffer(array: Annotated[numpy.typing.ArrayLike, numpy.float64]) pycolmap.Rotation3d#

Create from numpy array view (zero-copy if contiguous).

property quat#

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

normalize(self: pycolmap.Rotation3d) None#
matrix(self: pycolmap.Rotation3d) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']#
norm(self: pycolmap.Rotation3d) float#
angle(self: pycolmap.Rotation3d) float#
angle_to(self: pycolmap.Rotation3d, other: pycolmap.Rotation3d) float#
inverse(self: pycolmap.Rotation3d) pycolmap.Rotation3d#
summary(self: pycolmap.Rotation3d, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Rotation3d, recursive: bool = True) dict#
class pycolmap.AlignedBox3d(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.AlignedBox3d) None

  2. __init__(self: pycolmap.AlignedBox3d, min: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"], max: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"]) None

  3. __init__(self: pycolmap.AlignedBox3d, arg0: dict) None

  4. __init__(self: pycolmap.AlignedBox3d, **kwargs) None

property min#

(ndarray, default: [1.79769313e+308 1.79769313e+308 1.79769313e+308])

property max#

(ndarray, default: [-1.79769313e+308 -1.79769313e+308 -1.79769313e+308])

diagonal(self: pycolmap.AlignedBox3d) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
contains_point(
self: pycolmap.AlignedBox3d,
point: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
) bool#
contains_bbox(self: pycolmap.AlignedBox3d, other: pycolmap.AlignedBox3d) bool#
summary(self: pycolmap.AlignedBox3d, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.AlignedBox3d, recursive: bool = True) dict#
class pycolmap.Rigid3d(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Rigid3d) None

  2. __init__(self: pycolmap.Rigid3d, rotation: Rotation3d, translation: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"]) None

  3. __init__(self: pycolmap.Rigid3d, matrix: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 4]"]) None

3x4 transformation matrix.

  1. __init__(self: pycolmap.Rigid3d, arg0: dict) None

  2. __init__(self: pycolmap.Rigid3d, **kwargs) None

property params#

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

property rotation#

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

property translation#

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

matrix(self: pycolmap.Rigid3d) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']#
tgt_origin_in_src(self: pycolmap.Rigid3d) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
adjoint(self: pycolmap.Rigid3d) Annotated[numpy.typing.NDArray[numpy.float64], '[6, 6]']#
adjoint_inverse(self: pycolmap.Rigid3d) Annotated[numpy.typing.NDArray[numpy.float64], '[6, 6]']#
inverse(self: pycolmap.Rigid3d) pycolmap.Rigid3d#
static interpolate(
cam_from_world1: pycolmap.Rigid3d,
cam_from_world2: pycolmap.Rigid3d,
t: SupportsFloat | SupportsIndex,
) pycolmap.Rigid3d#
summary(self: pycolmap.Rigid3d, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Rigid3d, recursive: bool = True) dict#
pycolmap.get_covariance_for_inverse(
rigid3d: pycolmap.Rigid3d,
covar: Annotated[numpy.typing.ArrayLike, numpy.float64, '[6, 6]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[6, 6]']#
pycolmap.get_covariance_for_composed_rigid3d(
left_rigid3d: pycolmap.Rigid3d,
joint_covar: Annotated[numpy.typing.ArrayLike, numpy.float64, '[12, 12]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[6, 6]']#
pycolmap.get_covariance_for_relative_rigid3d(
base_rigid3d: pycolmap.Rigid3d,
target_rigid3d: pycolmap.Rigid3d,
joint_covar: Annotated[numpy.typing.ArrayLike, numpy.float64, '[12, 12]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[6, 6]']#
pycolmap.average_quaternions(
quats: collections.abc.Sequence[Rotation3d],
weights: collections.abc.Sequence[SupportsFloat | SupportsIndex],
) Rotation3d#
pycolmap.interpolate_camera_poses(
cam1_from_world: pycolmap.Rigid3d,
cam2_from_world: pycolmap.Rigid3d,
t: SupportsFloat | SupportsIndex,
) pycolmap.Rigid3d#
class pycolmap.Sim3d(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Sim3d) None

  2. __init__(self: pycolmap.Sim3d, scale: typing.SupportsFloat | typing.SupportsIndex, rotation: Rotation3d, translation: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"]) None

  3. __init__(self: pycolmap.Sim3d, matrix: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 4]"]) None

3x4 transformation matrix.

  1. __init__(self: pycolmap.Sim3d, arg0: dict) None

  2. __init__(self: pycolmap.Sim3d, **kwargs) None

property params#

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

property scale#

(ndarray, default: 1.0)

property rotation#

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

property translation#

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

matrix(self: pycolmap.Sim3d) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 4]']#
transform_camera_world(self: pycolmap.Sim3d, cam_from_world: pycolmap.Rigid3d) pycolmap.Rigid3d#
inverse(self: pycolmap.Sim3d) pycolmap.Sim3d#
summary(self: pycolmap.Sim3d, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Sim3d, recursive: bool = True) dict#
class pycolmap.PosePriorCoordinateSystem(*args, **kwargs)#

Members:

UNDEFINED

WGS84

CARTESIAN

Overloaded function.

  1. __init__(self: pycolmap.PosePriorCoordinateSystem, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.PosePriorCoordinateSystem, name: str) None

property name#
property value#
UNDEFINED = PosePriorCoordinateSystem.UNDEFINED#
WGS84 = PosePriorCoordinateSystem.WGS84#
CARTESIAN = PosePriorCoordinateSystem.CARTESIAN#
class pycolmap.PosePrior(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.PosePrior) None

  2. __init__(self: pycolmap.PosePrior, arg0: dict) None

  3. __init__(self: pycolmap.PosePrior, **kwargs) None

property pose_prior_id#

(int, default: 4294967295)

property corr_data_id#

(data_t, default: data_t(sensor_id=sensor_t(type=SensorType.INVALID, id=4294967295), id=4294967295))

property position#

(ndarray, default: [nan nan nan])

property position_covariance#

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

property coordinate_system#

(PosePriorCoordinateSystem, default: PosePriorCoordinateSystem.UNDEFINED)

property gravity#

(ndarray, default: [nan nan nan])

has_position(self: pycolmap.PosePrior) bool#
has_position_cov(self: pycolmap.PosePrior) bool#
has_gravity(self: pycolmap.PosePrior) bool#
is_valid(*args, **kwargs) object#

Deprecated, use has_position instead.

is_covariance_valid(*args, **kwargs) object#

Deprecated, use has_position_cov instead.

summary(self: pycolmap.PosePrior, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.PosePrior, recursive: bool = True) dict#
pycolmap.compute_rot90_from_gravity(gravity: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]']) int#

Compute number of 90 deg CCW rotations to make sensor upright.

class pycolmap.GPSTransfromEllipsoid(*args, **kwargs)#

Members:

GRS80

WGS84

Overloaded function.

  1. __init__(self: pycolmap.GPSTransfromEllipsoid, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.GPSTransfromEllipsoid, name: str) None

property name#
property value#
GRS80 = GPSTransfromEllipsoid.GRS80#
WGS84 = GPSTransfromEllipsoid.WGS84#
class pycolmap.GPSTransform(self: pycolmap.GPSTransform, ellipsoid: pycolmap.GPSTransfromEllipsoid = GPSTransfromEllipsoid.GRS80)#
ellipsoid_to_ecef(
self: pycolmap.GPSTransform,
lat_lon_alt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]']#
ecef_to_ellipsoid(
self: pycolmap.GPSTransform,
xyz_in_ecef: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]']#
ellipsoid_to_enu(
self: pycolmap.GPSTransform,
lat_lon_alt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
ref_lat: SupportsFloat | SupportsIndex,
ref_lon: SupportsFloat | SupportsIndex,
ref_alt: SupportsFloat | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]']#
ecef_to_enu(
self: pycolmap.GPSTransform,
xyz_in_ecef: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
ref_ecef: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]']#
enu_to_ellipsoid(
self: pycolmap.GPSTransform,
xyz_in_enu: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
ref_lat: SupportsFloat | SupportsIndex,
ref_lon: SupportsFloat | SupportsIndex,
ref_alt: SupportsFloat | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]']#
enu_to_ecef(
self: pycolmap.GPSTransform,
xyz_in_enu: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
ref_lat: SupportsFloat | SupportsIndex,
ref_lon: SupportsFloat | SupportsIndex,
ref_alt: SupportsFloat | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]']#
ellipsoid_to_utm(
self: pycolmap.GPSTransform,
lat_lon_alt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
) tuple[Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]'], int]#
utm_to_ellipsoid(
self: pycolmap.GPSTransform,
xyz_in_utm: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
zone: SupportsInt | SupportsIndex,
is_north: bool,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, 3]']#
pycolmap.pose_from_homography_matrix(
H: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]'],
K1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]'],
K2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]'],
cam_rays1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
cam_rays2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
) dict#

Recover the most probable pose from the given homography matrix using the cheirality check.

pycolmap.essential_matrix_from_pose(
cam2_from_cam1: pycolmap.Rigid3d,
) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']#

Construct essential matrix from relative pose.

pycolmap.triangulate_point(*args, **kwargs)#

Overloaded function.

  1. triangulate_point(cam1_from_world: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 4]"], cam2_from_world: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 4]"], cam_point1: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"], cam_point2: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[3, 1]"] | None

Triangulate point in world from two-view observation.

  1. triangulate_point(cam1_from_world: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 4]"], cam2_from_world: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 4]"], cam_ray1: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"], cam_ray2: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[3, 1]"] | None

Triangulate point in world from two-view bearing-vector observation.

pycolmap.triangulate_multi_view_point(
cams_from_world: collections.abc.Sequence[Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 4]']],
cam_rays: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]'] | None#

Triangulate point in world from multi-view bearing-vector observations.

pycolmap.calculate_triangulation_angle(
proj_center1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
proj_center2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
point3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
) float#

Calculate triangulation angle in radians.

pycolmap.triangulate_mid_point(
cam2_from_cam1: pycolmap.Rigid3d,
cam_ray1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
cam_ray2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]'] | None#

Triangulate mid-point in first camera from two-view observation.

class pycolmap.RANSACOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.RANSACOptions) None

  2. __init__(self: pycolmap.RANSACOptions, arg0: dict) None

  3. __init__(self: pycolmap.RANSACOptions, **kwargs) None

property max_error#

(float, default: 4.0)

property min_inlier_ratio#

(float, default: 0.01)

property confidence#

(float, default: 0.9999)

property dyn_num_trials_multiplier#

(float, default: 3.0)

property min_num_trials#

(int, default: 1000)

property max_num_trials#

(int, default: 100000)

property random_seed#

(int, default: -1)

property num_threads#

(int, default: 1)

check(self: pycolmap.RANSACOptions) None#
summary(self: pycolmap.RANSACOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.RANSACOptions, recursive: bool = True) dict#
class pycolmap.BitmapRescaleFilter(*args, **kwargs)#

Members:

BILINEAR

BOX

Overloaded function.

  1. __init__(self: pycolmap.BitmapRescaleFilter, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.BitmapRescaleFilter, name: str) None

property name#
property value#
BILINEAR = BitmapRescaleFilter.BILINEAR#
BOX = BitmapRescaleFilter.BOX#
class pycolmap.Bitmap(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Bitmap) None

  2. __init__(self: pycolmap.Bitmap, width: typing.SupportsInt | typing.SupportsIndex, height: typing.SupportsInt | typing.SupportsIndex, as_rgb: bool, linear_colorspace: bool = False) None

to_array(self: pycolmap.Bitmap) numpy.typing.NDArray[numpy.uint8]#
static from_array(
array: Annotated[numpy.typing.ArrayLike, numpy.uint8],
linear_colorspace: bool = False,
) pycolmap.Bitmap#

Create bitmap as a copy of array. Returns RGB bitmap, if array has shape (H, W, 3), or grayscale bitmap, if array has shape (H, W[, 1]).

write(self: pycolmap.Bitmap, path: os.PathLike | str | bytes, delinearize_colorspace: bool = True) bool#

Write bitmap to file at given path. Defaults to converting to sRGB colorspace for file storage.

static read(path: os.PathLike | str | bytes, as_rgb: bool, linearize_colorspace: bool = False) pycolmap.Bitmap | None#

Read bitmap at given path and convert to grey- or colorscale. Defaults to keeping the original colorspace (potentially non-linear) for image processing.

rescale(
self: pycolmap.Bitmap,
new_width: SupportsInt | SupportsIndex,
new_height: SupportsInt | SupportsIndex,
filter: pycolmap.BitmapRescaleFilter = BitmapRescaleFilter.BILINEAR,
) None#

Rescale image to the new dimensions.

thumbnail(
self: pycolmap.Bitmap,
max_image_size: SupportsInt | SupportsIndex,
filter: pycolmap.BitmapRescaleFilter = BitmapRescaleFilter.BILINEAR,
) float#

Downscale the image so neither dimension exceeds max_image_size, preserving the aspect ratio. Images already within the bound are left unchanged. Returns the applied scale factor (1 if no rescaling was necessary).

rot90(self: pycolmap.Bitmap, arg0: SupportsInt | SupportsIndex) None#

Rotate image by k * 90 degrees counter-clockwise.

property width#

Width of the image.

property height#

Height of the image.

property channels#

Number of channels of the image.

property is_rgb#

Whether the image is colorscale.

property is_grey#

Whether the image is greyscale.

property is_empty#

Whether the image is empty.

property bits_per_pixel#

Number of bits per pixel (8 for grey, 24 for RGB).

property pitch#

Scan line size in bytes (stride).

clone(self: pycolmap.Bitmap) pycolmap.Bitmap#

Clone the image to a new bitmap.

clone_as_grey(self: pycolmap.Bitmap) pycolmap.Bitmap#

Clone the image as grayscale.

clone_as_rgb(self: pycolmap.Bitmap) pycolmap.Bitmap#

Clone the image as RGB.

set_jpeg_quality(self: pycolmap.Bitmap, quality: SupportsInt | SupportsIndex) None#

Set compression quality when writing to JPEG in the range [1, 100]. Lower values reduce quality and file size. By default, bitmaps are written in superb (100) quality, if not otherwise specified.

exif_orientation(self: pycolmap.Bitmap) int | None#

Extract EXIF orientation. Returns None if not available.

exif_camera_model(self: pycolmap.Bitmap) str | None#

Extract EXIF camera model. Returns None if not available.

exif_focal_length(self: pycolmap.Bitmap) float | None#

Extract EXIF focal length. Returns None if not available.

exif_latitude(self: pycolmap.Bitmap) float | None#

Extract EXIF latitude. Returns None if not available.

exif_longitude(self: pycolmap.Bitmap) float | None#

Extract EXIF longitude. Returns None if not available.

exif_altitude(self: pycolmap.Bitmap) float | None#

Extract EXIF altitude. Returns None if not available.

class pycolmap.Rig(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Rig) None

  2. __init__(self: pycolmap.Rig, arg0: dict) None

  3. __init__(self: pycolmap.Rig, **kwargs) None

property rig_id#

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

add_ref_sensor(self: pycolmap.Rig, arg0: pycolmap.sensor_t) None#

sensor_idAdd reference sensor.

add_sensor(self: pycolmap.Rig, arg0: pycolmap.sensor_t, arg1: pycolmap.Rigid3d | None) None#

sensor_idAdd non-reference sensor.

has_sensor(self: pycolmap.Rig, arg0: pycolmap.sensor_t) bool#

Whether the rig has a specific sensor.

is_ref_sensor(self: pycolmap.Rig, arg0: pycolmap.sensor_t) bool#

Check whether the given sensor is the reference sensor.

has_sensor_from_rig(self: pycolmap.Rig, sensor_id: pycolmap.sensor_t) bool#

Check if sensor has calibrated transformation from rig.

num_sensors(self: pycolmap.Rig) int#

The number of sensors in the rig.

property ref_sensor_id#

The reference sensor’s identifier. (sensor_t, default: sensor_t(type=SensorType.INVALID, id=4294967295))

sensor_ids(self: pycolmap.Rig) set[pycolmap.sensor_t]#

Get all sensor ids (including the reference sensor) in the rig.

sensor_from_rig(self: pycolmap.Rig, sensor_id: pycolmap.sensor_t) pycolmap.Rigid3d | None#

The transformation from rig to the sensor.

set_sensor_from_rig(
self: pycolmap.Rig,
sensor_id: pycolmap.sensor_t,
sensor_from_rig: pycolmap.Rigid3d | None,
) None#

Set the sensor_from_rig transformation.

reset_sensor_from_rig(self: pycolmap.Rig, sensor_id: pycolmap.sensor_t) None#

Reset the sensor’s calibration.

property non_ref_sensors#

Access all sensors in the rig except for reference sensor (dict, default: {})

summary(self: pycolmap.Rig, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Rig, recursive: bool = True) dict#
class pycolmap.RigMap(self: pycolmap.RigMap)#
keys(self: pycolmap.RigMap) pycolmap.KeysView#
values(self: pycolmap.RigMap) pycolmap.ValuesView#
items(self: pycolmap.RigMap) pycolmap.ItemsView#
class pycolmap.KeysView#
class pycolmap.ValuesView#
class pycolmap.ItemsView#
class pycolmap.FeatureExtractorType(self: pycolmap.FeatureExtractorType, value: SupportsInt | SupportsIndex)#

Members:

UNDEFINED

SIFT

ALIKED_N16ROT

ALIKED_N32

property name#
property value#
UNDEFINED = <FeatureExtractorType.UNDEFINED: -1>#
SIFT = <FeatureExtractorType.SIFT: 0>#
ALIKED_N16ROT = <FeatureExtractorType.ALIKED_N16ROT: 1>#
ALIKED_N32 = <FeatureExtractorType.ALIKED_N32: 2>#
class pycolmap.FeatureDescriptors(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureDescriptors) None

  2. __init__(self: pycolmap.FeatureDescriptors, type: pycolmap.FeatureExtractorType, data: typing.Annotated[numpy.typing.ArrayLike, numpy.uint8, "[m, n]"]) None

  3. __init__(self: pycolmap.FeatureDescriptors, arg0: dict) None

  4. __init__(self: pycolmap.FeatureDescriptors, **kwargs) None

property type#

(FeatureExtractorType, default: FeatureExtractorType.UNDEFINED)

property data#

(ndarray, default: [])

static from_float(float_desc: pycolmap.FeatureDescriptorsFloat) pycolmap.FeatureDescriptors#

Create from float descriptors by reinterpreting float32 data as uint8 bytes.

to_float(self: pycolmap.FeatureDescriptors) pycolmap.FeatureDescriptorsFloat#

Convert to float descriptors by reinterpreting uint8 data as float32.

summary(self: pycolmap.FeatureDescriptors, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.FeatureDescriptors, recursive: bool = True) dict#
class pycolmap.FeatureDescriptorsFloat(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureDescriptorsFloat) None

  2. __init__(self: pycolmap.FeatureDescriptorsFloat, type: pycolmap.FeatureExtractorType, data: typing.Annotated[numpy.typing.ArrayLike, numpy.float32, "[m, n]"]) None

  3. __init__(self: pycolmap.FeatureDescriptorsFloat, arg0: dict) None

  4. __init__(self: pycolmap.FeatureDescriptorsFloat, **kwargs) None

property type#

(FeatureExtractorType, default: FeatureExtractorType.UNDEFINED)

property data#

(ndarray, default: [])

static from_bytes(byte_desc: pycolmap.FeatureDescriptors) pycolmap.FeatureDescriptorsFloat#

Create from byte descriptors by reinterpreting uint8 data as float32.

to_bytes(self: pycolmap.FeatureDescriptorsFloat) pycolmap.FeatureDescriptors#

Convert to byte descriptors by reinterpreting float32 data as uint8.

summary(self: pycolmap.FeatureDescriptorsFloat, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.FeatureDescriptorsFloat, recursive: bool = True) dict#
class pycolmap.FeatureKeypoint(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureKeypoint) None

  2. __init__(self: pycolmap.FeatureKeypoint, arg0: dict) None

  3. __init__(self: pycolmap.FeatureKeypoint, **kwargs) None

property x#

(float, default: 0.0)

property y#

(float, default: 0.0)

property a11#

(float, default: 1.0)

property a12#

(float, default: 0.0)

property a21#

(float, default: 0.0)

property a22#

(float, default: 1.0)

static from_shape_parameters(
arg0: SupportsFloat | SupportsIndex,
arg1: SupportsFloat | SupportsIndex,
arg2: SupportsFloat | SupportsIndex,
arg3: SupportsFloat | SupportsIndex,
arg4: SupportsFloat | SupportsIndex,
arg5: SupportsFloat | SupportsIndex,
) pycolmap.FeatureKeypoint#
rescale(*args, **kwargs)#

Overloaded function.

  1. rescale(self: pycolmap.FeatureKeypoint, arg0: typing.SupportsFloat | typing.SupportsIndex) None

  2. rescale(self: pycolmap.FeatureKeypoint, arg0: typing.SupportsFloat | typing.SupportsIndex, arg1: typing.SupportsFloat | typing.SupportsIndex) None

compute_scale(self: pycolmap.FeatureKeypoint) float#
compute_scale_x(self: pycolmap.FeatureKeypoint) float#
compute_scale_y(self: pycolmap.FeatureKeypoint) float#
compute_orientation(self: pycolmap.FeatureKeypoint) float#
compute_shear(self: pycolmap.FeatureKeypoint) float#
summary(self: pycolmap.FeatureKeypoint, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.FeatureKeypoint, recursive: bool = True) dict#
class pycolmap.FeatureKeypoints(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureKeypoints) None

  2. __init__(self: pycolmap.FeatureKeypoints, arg0: pycolmap.FeatureKeypoints) None

Copy constructor

  1. __init__(self: pycolmap.FeatureKeypoints, arg0: collections.abc.Iterable) None

count(self: pycolmap.FeatureKeypoints, x: pycolmap.FeatureKeypoint) int#

Return the number of times x appears in the list

remove(self: pycolmap.FeatureKeypoints, x: pycolmap.FeatureKeypoint) None#

Remove the first item from the list whose value is x. It is an error if there is no such item.

append(self: pycolmap.FeatureKeypoints, x: pycolmap.FeatureKeypoint) None#

Add an item to the end of the list

clear(self: pycolmap.FeatureKeypoints) None#

Clear the contents

extend(*args, **kwargs)#

Overloaded function.

  1. extend(self: pycolmap.FeatureKeypoints, L: pycolmap.FeatureKeypoints) None

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

  1. extend(self: pycolmap.FeatureKeypoints, L: collections.abc.Iterable) None

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

insert(
self: pycolmap.FeatureKeypoints,
i: SupportsInt | SupportsIndex,
x: pycolmap.FeatureKeypoint,
) None#

Insert an item at a given position.

pop(*args, **kwargs)#

Overloaded function.

  1. pop(self: pycolmap.FeatureKeypoints) pycolmap.FeatureKeypoint

Remove and return the last item

  1. pop(self: pycolmap.FeatureKeypoints, i: typing.SupportsInt | typing.SupportsIndex) pycolmap.FeatureKeypoint

Remove and return the item at index i

class pycolmap.FeatureMatch(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureMatch) None

  2. __init__(self: pycolmap.FeatureMatch, arg0: typing.SupportsInt | typing.SupportsIndex, arg1: typing.SupportsInt | typing.SupportsIndex) None

  3. __init__(self: pycolmap.FeatureMatch, arg0: dict) None

  4. __init__(self: pycolmap.FeatureMatch, **kwargs) None

property point2D_idx1#

(int, default: 4294967295)

property point2D_idx2#

(int, default: 4294967295)

summary(self: pycolmap.FeatureMatch, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.FeatureMatch, recursive: bool = True) dict#
class pycolmap.FeatureMatches(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureMatches) None

  2. __init__(self: pycolmap.FeatureMatches, arg0: pycolmap.FeatureMatches) None

Copy constructor

  1. __init__(self: pycolmap.FeatureMatches, arg0: collections.abc.Iterable) None

count(self: pycolmap.FeatureMatches, x: pycolmap.FeatureMatch) int#

Return the number of times x appears in the list

remove(self: pycolmap.FeatureMatches, x: pycolmap.FeatureMatch) None#

Remove the first item from the list whose value is x. It is an error if there is no such item.

append(self: pycolmap.FeatureMatches, x: pycolmap.FeatureMatch) None#

Add an item to the end of the list

clear(self: pycolmap.FeatureMatches) None#

Clear the contents

extend(*args, **kwargs)#

Overloaded function.

  1. extend(self: pycolmap.FeatureMatches, L: pycolmap.FeatureMatches) None

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

  1. extend(self: pycolmap.FeatureMatches, L: collections.abc.Iterable) None

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

insert(
self: pycolmap.FeatureMatches,
i: SupportsInt | SupportsIndex,
x: pycolmap.FeatureMatch,
) None#

Insert an item at a given position.

pop(*args, **kwargs)#

Overloaded function.

  1. pop(self: pycolmap.FeatureMatches) pycolmap.FeatureMatch

Remove and return the last item

  1. pop(self: pycolmap.FeatureMatches, i: typing.SupportsInt | typing.SupportsIndex) pycolmap.FeatureMatch

Remove and return the item at index i

pycolmap.keypoints_to_matrix(
keypoints: pycolmap.FeatureKeypoints,
) Annotated[numpy.typing.NDArray[numpy.float32], '[m, 4]']#

Convert FeatureKeypoints to an Nx4 matrix [x, y, scale, orientation].

pycolmap.keypoints_from_matrix(
keypoints: Annotated[numpy.typing.NDArray[numpy.float32], '[m, 4]', 'flags.c_contiguous'],
) pycolmap.FeatureKeypoints#

Convert an Nx4 matrix [x, y, scale, orientation] to FeatureKeypoints.

pycolmap.matches_to_matrix(matches: pycolmap.FeatureMatches) Annotated[numpy.typing.NDArray[numpy.uint32], '[m, 2]']#

Convert FeatureMatches to an Nx2 matrix of point2D indices.

pycolmap.matches_from_matrix(
matches: Annotated[numpy.typing.NDArray[numpy.uint32], '[m, 2]', 'flags.c_contiguous'],
) pycolmap.FeatureMatches#

Convert an Nx2 matrix of point2D indices to FeatureMatches.

class pycolmap.Point2D(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Point2D) None

  2. __init__(self: pycolmap.Point2D, xy: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"], point3D_id: typing.SupportsInt | typing.SupportsIndex = pycolmap.INVALID_POINT3D_ID) None

  3. __init__(self: pycolmap.Point2D, arg0: dict) None

  4. __init__(self: pycolmap.Point2D, **kwargs) None

property xy#

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

x(self: pycolmap.Point2D) float#
y(self: pycolmap.Point2D) float#
property point3D_id#

(int, default: 18446744073709551615)

has_point3D(self: pycolmap.Point2D) bool#
summary(self: pycolmap.Point2D, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Point2D, recursive: bool = True) dict#
class pycolmap.Point2DList(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Point2DList) None

  2. __init__(self: pycolmap.Point2DList, arg0: pycolmap.Point2DList) None

Copy constructor

  1. __init__(self: pycolmap.Point2DList, arg0: collections.abc.Iterable) None

count(self: pycolmap.Point2DList, x: pycolmap.Point2D) int#

Return the number of times x appears in the list

remove(self: pycolmap.Point2DList, x: pycolmap.Point2D) None#

Remove the first item from the list whose value is x. It is an error if there is no such item.

append(self: pycolmap.Point2DList, x: pycolmap.Point2D) None#

Add an item to the end of the list

clear(self: pycolmap.Point2DList) None#

Clear the contents

extend(*args, **kwargs)#

Overloaded function.

  1. extend(self: pycolmap.Point2DList, L: pycolmap.Point2DList) None

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

  1. extend(self: pycolmap.Point2DList, L: collections.abc.Iterable) None

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

insert(
self: pycolmap.Point2DList,
i: SupportsInt | SupportsIndex,
x: pycolmap.Point2D,
) None#

Insert an item at a given position.

pop(*args, **kwargs)#

Overloaded function.

  1. pop(self: pycolmap.Point2DList) pycolmap.Point2D

Remove and return the last item

  1. pop(self: pycolmap.Point2DList, i: typing.SupportsInt | typing.SupportsIndex) pycolmap.Point2D

Remove and return the item at index i

class pycolmap.CameraModelId(*args, **kwargs)#

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

SIMPLE_DIVISION

DIVISION

SIMPLE_FISHEYE

FISHEYE

EUCM

EQUIRECTANGULAR

Overloaded function.

  1. __init__(self: pycolmap.CameraModelId, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.CameraModelId, name: str) None

property name#
property value#
INVALID = CameraModelId.INVALID#
SIMPLE_PINHOLE = CameraModelId.SIMPLE_PINHOLE#
PINHOLE = CameraModelId.PINHOLE#
SIMPLE_RADIAL = CameraModelId.SIMPLE_RADIAL#
SIMPLE_RADIAL_FISHEYE = CameraModelId.SIMPLE_RADIAL_FISHEYE#
RADIAL = CameraModelId.RADIAL#
RADIAL_FISHEYE = CameraModelId.RADIAL_FISHEYE#
OPENCV = CameraModelId.OPENCV#
OPENCV_FISHEYE = CameraModelId.OPENCV_FISHEYE#
FULL_OPENCV = CameraModelId.FULL_OPENCV#
FOV = CameraModelId.FOV#
THIN_PRISM_FISHEYE = CameraModelId.THIN_PRISM_FISHEYE#
RAD_TAN_THIN_PRISM_FISHEYE = CameraModelId.RAD_TAN_THIN_PRISM_FISHEYE#
SIMPLE_DIVISION = CameraModelId.SIMPLE_DIVISION#
DIVISION = CameraModelId.DIVISION#
SIMPLE_FISHEYE = CameraModelId.SIMPLE_FISHEYE#
FISHEYE = CameraModelId.FISHEYE#
EUCM = CameraModelId.EUCM#
EQUIRECTANGULAR = CameraModelId.EQUIRECTANGULAR#
class pycolmap.Camera(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Camera) None

  2. __init__(self: pycolmap.Camera, arg0: dict) None

  3. __init__(self: pycolmap.Camera, **kwargs) None

static create_from_model_id(
camera_id: SupportsInt | SupportsIndex,
model: pycolmap.CameraModelId,
focal_length: SupportsFloat | SupportsIndex,
width: SupportsInt | SupportsIndex,
height: SupportsInt | SupportsIndex,
) pycolmap.Camera#
static create_from_model_name(
camera_id: SupportsInt | SupportsIndex,
model_name: str,
focal_length: SupportsFloat | SupportsIndex,
width: SupportsInt | SupportsIndex,
height: SupportsInt | SupportsIndex,
) pycolmap.Camera#

Create camera from model name string.

property camera_id#

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

property sensor_id#

Unique identifier of the sensor. (sensor_t, default: sensor_t(type=SensorType.CAMERA, id=4294967295))

property model#

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

property model_name#

Camera model name as string. (str, default: )

property width#

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

property height#

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

mean_focal_length(self: pycolmap.Camera) float#
property focal_length#
property focal_length_x#
property focal_length_y#
property has_prior_focal_length#

(bool, default: False)

property principal_point_x#
property principal_point_y#
focal_length_idxs(self: pycolmap.Camera) list[int]#

Indices of focal length parameters in params property.

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

Indices of principal point parameters in params property.

extra_params_idxs(self: pycolmap.Camera) list[int]#

Indices of extra parameters in params property.

metadata_params_idxs(self: pycolmap.Camera) list[int]#

Indices of metadata parameters in params property (only spherical models have these; empty for perspective models).

calibration_matrix(self: pycolmap.Camera) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 3]']#

Compute calibration matrix from params.

property params_info#

Get human-readable information about the parameter vector ordering.

property params#

Camera parameters. (ndarray, default: [])

params_to_string(self: pycolmap.Camera) str#

Concatenate parameters as comma-separated list.

set_params_from_string(self: pycolmap.Camera, params: str) bool#

Set camera parameters from comma-separated list.

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.

has_bogus_params(
self: pycolmap.Camera,
min_focal_length_ratio: SupportsFloat | SupportsIndex,
max_focal_length_ratio: SupportsFloat | SupportsIndex,
max_extra_param: SupportsFloat | SupportsIndex,
) bool#

Check whether camera has bogus parameters.

is_undistorted(self: pycolmap.Camera) bool#

Check whether camera is already undistorted.

is_perspective(self: pycolmap.Camera) bool#

Whether the camera model is perspective, i.e. has a focal length and a finite pinhole image plane (so positive-depth cheirality applies). Omnidirectional models such as EQUIRECTANGULAR are not perspective.

is_spherical(self: pycolmap.Camera) bool#

Whether the camera model is spherical (equirectangular omnidirectional panorama).

cam_from_img(*args, **kwargs)#

Overloaded function.

  1. cam_from_img(self: pycolmap.Camera, image_point: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[2, 1]"] | None

Unproject point in image plane to camera frame.

  1. cam_from_img(self: pycolmap.Camera, image_points: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 2]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 2]"]

Unproject list of points in image plane to camera frame.

  1. cam_from_img(self: pycolmap.Camera, image_points: pycolmap.Point2DList) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 2]"]

Unproject list of points in image plane to camera frame.

cam_ray_from_img(*args, **kwargs)#

Overloaded function.

  1. cam_ray_from_img(self: pycolmap.Camera, image_point: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[2, 1]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[3, 1]"] | None

Unproject point in image plane to a unit bearing vector in the camera frame. Unlike cam_from_img, this supports back-facing rays of omnidirectional cameras.

  1. cam_ray_from_img(self: pycolmap.Camera, image_points: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 2]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 3]"]

Unproject list of points in image plane to unit bearing vectors in the camera frame.

  1. cam_ray_from_img(self: pycolmap.Camera, image_points: pycolmap.Point2DList) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 3]"]

Unproject list of points in image plane to unit bearing vectors in the camera frame.

cam_from_img_threshold(self: pycolmap.Camera, threshold: SupportsFloat | SupportsIndex) float#

Convert pixel threshold in image plane to world space.

img_from_cam(*args, **kwargs)#

Overloaded function.

  1. img_from_cam(self: pycolmap.Camera, cam_point: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[3, 1]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[2, 1]"] | None

Project point from camera frame to image plane.

  1. img_from_cam(self: pycolmap.Camera, cam_points: typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 3]"]) typing.Annotated[numpy.typing.NDArray[numpy.float64], "[m, 2]"]

Project list of points from camera frame to image plane.

rescale(*args, **kwargs)#

Overloaded function.

  1. rescale(self: pycolmap.Camera, new_width: typing.SupportsInt | typing.SupportsIndex, new_height: typing.SupportsInt | typing.SupportsIndex) None

Rescale the camera dimensions and accordingly the focal length and the principal point.

  1. rescale(self: pycolmap.Camera, scale: typing.SupportsFloat | typing.SupportsIndex) None

Rescale the camera dimensions and accordingly the focal length and the principal point.

create(*args, **kwargs) object#

Deprecated, use create_from_model_id instead.

summary(self: pycolmap.Camera, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Camera, recursive: bool = True) dict#
class pycolmap.CameraMap(self: pycolmap.CameraMap)#
keys(self: pycolmap.CameraMap) pycolmap.KeysView#
values(self: pycolmap.CameraMap) pycolmap.ValuesView#
items(self: pycolmap.CameraMap) pycolmap.ItemsView#
class pycolmap.Frame(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Frame) None

  2. __init__(self: pycolmap.Frame, arg0: dict) None

  3. __init__(self: pycolmap.Frame, **kwargs) None

property frame_id#

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

property rig_id#

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

has_rig_id(self: pycolmap.Frame) bool#

Check whether the rig_id is set.

add_data_id(self: pycolmap.Frame, arg0: pycolmap.data_t) None#

Associate data with frame.

num_data_ids(self: pycolmap.Frame) int#

Number of associated data items in frame.

has_data(self: pycolmap.Frame, arg0: pycolmap.data_t) bool#

Check whether frame has associated data.

clear_data_ids(self: pycolmap.Frame) None#

Clear all the associated data.

finalize_data_ids(self: pycolmap.Frame) None#

Finalize data ids, preventing further modifications.

has_final_data_ids(self: pycolmap.Frame) bool#

Check whether data ids have been finalized.

property data_ids#

The associated data. (set, default: set())

data_ids_by_sensor(self: pycolmap.Frame, type: pycolmap.SensorType) list[pycolmap.data_t]#

The associated data for a given sensor type.

property image_ids#

The associated image data. (list, default: [])

property rig#

The associated rig object. (NoneType, default: None)

reset_rig_ptr(self: pycolmap.Frame) None#

Make the rig pointer a nullptr.

property rig_from_world#

The pose of the frame, defined as the transformation from world to rig space. (NoneType, default: None)

has_pose(self: pycolmap.Frame) bool#

Whether the frame has a valid pose.

reset_pose(self: pycolmap.Frame) None#

Invalidate the pose of the frame.

sensor_from_world(self: pycolmap.Frame, sensor_id: pycolmap.sensor_t) pycolmap.Rigid3d#

The transformation from the world to a specific sensor.

set_cam_from_world(
self: pycolmap.Frame,
camera_id: SupportsInt | SupportsIndex,
cam_from_world: pycolmap.Rigid3d,
) None#

Set the world to frame from the given camera from world transformation.

summary(self: pycolmap.Frame, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Frame, recursive: bool = True) dict#
class pycolmap.FrameMap(self: pycolmap.FrameMap)#
keys(self: pycolmap.FrameMap) pycolmap.KeysView#
values(self: pycolmap.FrameMap) pycolmap.ValuesView#
items(self: pycolmap.FrameMap) pycolmap.ItemsView#
class pycolmap.Image(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Image) None

  2. __init__(self: pycolmap.Image, name: str = '', points2D: pycolmap.Point2DList = Point2DList(), camera_id: typing.SupportsInt | typing.SupportsIndex = pycolmap.INVALID_CAMERA_ID, image_id: typing.SupportsInt | typing.SupportsIndex = pycolmap.INVALID_IMAGE_ID) None

  3. __init__(self: pycolmap.Image, name: str = '', keypoints: typing.Annotated[numpy.typing.ArrayLike, numpy.float64, "[m, 2]"] = array([], shape=(0, 2), dtype=float64), camera_id: typing.SupportsInt | typing.SupportsIndex = pycolmap.INVALID_CAMERA_ID, image_id: typing.SupportsInt | typing.SupportsIndex = pycolmap.INVALID_IMAGE_ID) None

  4. __init__(self: pycolmap.Image, arg0: dict) None

  5. __init__(self: pycolmap.Image, **kwargs) None

property image_id#

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

property camera_id#

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

property frame_id#

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

property data_id#

Unique identifier of the data. (data_t, default: data_t(sensor_id=sensor_t(type=SensorType.CAMERA, id=4294967295), id=4294967295))

property camera#

The associated camera object. (NoneType, default: None)

property frame#

The associated frame object. (NoneType, default: None)

property name#

Name of the image. (str, default: )

cam_from_world(self: pycolmap.Image) pycolmap.Rigid3d#

The pose of the image, defined as the transformation from world to camera space. This method is read-only and support non-trivial frame (rig).

property has_pose#

Whether the image has a valid pose. (bool, default: False)

property points2D#

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

point2D(self: pycolmap.Image, point2D_idx: SupportsInt | SupportsIndex) pycolmap.Point2D#

Direct accessor for a point2D.

set_point3D_for_point2D(
self: pycolmap.Image,
point2D_Idx: SupportsInt | SupportsIndex,
point3D_id: SupportsInt | SupportsIndex,
) None#

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

reset_point3D_for_point2D(self: pycolmap.Image, point2D_idx: SupportsInt | SupportsIndex) None#

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

has_point3D(self: pycolmap.Image, point3D_id: SupportsInt | SupportsIndex) bool#

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

projection_center(self: pycolmap.Image) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#

Extract the projection center in world space.

viewing_direction(self: pycolmap.Image) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#

Extract the viewing direction of the image.

project_point(
self: pycolmap.Image,
point3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 1]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[2, 1]'] | None#

Project 3D point onto the image

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.

reset_camera_ptr(self: pycolmap.Image) None#

Make the camera pointer a nullptr.

has_frame_id(self: pycolmap.Image) bool#

Check whether identifier of frame has been set.

has_frame_ptr(self: pycolmap.Image) bool#

Check whether the frame pointer has been set.

reset_frame_ptr(self: pycolmap.Image) None#

Make the frame pointer a nullptr.

is_ref_in_frame(self: pycolmap.Image) bool#

Check if the image was captured by the reference sensor in the rig.

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)

get_observation_point2D_idxs(self: pycolmap.Image) list[int]#

Get the indices of 2D points that observe a 3D point.

get_observation_points2D(self: pycolmap.Image) pycolmap.Point2DList#

Get the 2D points that observe a 3D point.

summary(self: pycolmap.Image, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Image, recursive: bool = True) dict#
class pycolmap.ImageMap(self: pycolmap.ImageMap)#
keys(self: pycolmap.ImageMap) pycolmap.KeysView#
values(self: pycolmap.ImageMap) pycolmap.ValuesView#
items(self: pycolmap.ImageMap) pycolmap.ItemsView#
class pycolmap.TwoViewGeometryConfiguration(*args, **kwargs)#

Members:

UNDEFINED

DEGENERATE

CALIBRATED

CALIBRATED_RIG

UNCALIBRATED

PLANAR

PANORAMIC

PLANAR_OR_PANORAMIC

WATERMARK

MULTIPLE

Overloaded function.

  1. __init__(self: pycolmap.TwoViewGeometryConfiguration, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.TwoViewGeometryConfiguration, name: str) None

property name#
property value#
UNDEFINED = TwoViewGeometryConfiguration.UNDEFINED#
DEGENERATE = TwoViewGeometryConfiguration.DEGENERATE#
CALIBRATED = TwoViewGeometryConfiguration.CALIBRATED#
CALIBRATED_RIG = TwoViewGeometryConfiguration.CALIBRATED_RIG#
UNCALIBRATED = TwoViewGeometryConfiguration.UNCALIBRATED#
PLANAR = TwoViewGeometryConfiguration.PLANAR#
PANORAMIC = TwoViewGeometryConfiguration.PANORAMIC#
PLANAR_OR_PANORAMIC = TwoViewGeometryConfiguration.PLANAR_OR_PANORAMIC#
WATERMARK = TwoViewGeometryConfiguration.WATERMARK#
MULTIPLE = TwoViewGeometryConfiguration.MULTIPLE#
class pycolmap.TwoViewGeometry(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.TwoViewGeometry) None

  2. __init__(self: pycolmap.TwoViewGeometry, arg0: dict) None

  3. __init__(self: pycolmap.TwoViewGeometry, **kwargs) None

property config#

(int, default: 0)

property E#

(NoneType, default: None)

property F#

(NoneType, default: None)

property H#

(NoneType, default: None)

property cam2_from_cam1#

(NoneType, default: None)

property inlier_matches#

(ndarray, default: [])

property tri_angle#

(float, default: -1.0)

invert(self: pycolmap.TwoViewGeometry) None#
summary(self: pycolmap.TwoViewGeometry, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.TwoViewGeometry, recursive: bool = True) dict#
class pycolmap.Normalization(*args, **kwargs)#

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.

Overloaded function.

  1. __init__(self: pycolmap.Normalization, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.Normalization, name: str) None

property name#
property value#
L1_ROOT = Normalization.L1_ROOT#
L2 = Normalization.L2#
class pycolmap.SiftExtractionOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.SiftExtractionOptions) None

  2. __init__(self: pycolmap.SiftExtractionOptions, arg0: dict) None

  3. __init__(self: pycolmap.SiftExtractionOptions, **kwargs) None

property max_num_features#

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

property first_octave#

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

property num_octaves#

(int, default: 4)

property octave_resolution#

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

property peak_threshold#

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

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 max_num_orientations#

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

property upright#

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

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_min_scale#

(float, default: 0.16666666666666666)

property dsp_max_scale#

(float, default: 3.0)

property dsp_num_scales#

(int, default: 10)

property normalization#

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

check(self: pycolmap.SiftExtractionOptions) bool#
summary(self: pycolmap.SiftExtractionOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.SiftExtractionOptions, recursive: bool = True) dict#
class pycolmap.FeatureExtractionOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureExtractionOptions, type: pycolmap.FeatureExtractorType = <FeatureExtractorType.SIFT: 0>) None

  2. __init__(self: pycolmap.FeatureExtractionOptions, arg0: dict) None

  3. __init__(self: pycolmap.FeatureExtractionOptions, **kwargs) None

property type#

(FeatureExtractorType, default: FeatureExtractorType.SIFT)

property max_image_size#

Maximum image size, otherwise image will be down-scaled. If max_image_size is non-positive, the appropriate size is selected automatically based on the extractor type. (int, default: -1)

property num_threads#

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

property use_gpu#

(bool, default: False)

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 sift#

(SiftExtractionOptions, default: SiftExtractionOptions(max_num_features=8192, first_octave=-1, num_octaves=4, octave_resolution=3, peak_threshold=0.006666666666666667, edge_threshold=10.0, estimate_affine_shape=False, max_num_orientations=2, upright=False, darkness_adaptivity=False, domain_size_pooling=False, dsp_min_scale=0.16666666666666666, dsp_max_scale=3.0, dsp_num_scales=10, normalization=Normalization.L1_ROOT))

requires_rgb(self: pycolmap.FeatureExtractionOptions) bool#
requires_opengl(self: pycolmap.FeatureExtractionOptions) bool#
eff_max_image_size(self: pycolmap.FeatureExtractionOptions) int#
check(self: pycolmap.FeatureExtractionOptions) bool#
summary(self: pycolmap.FeatureExtractionOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.FeatureExtractionOptions, recursive: bool = True) dict#
class pycolmap.FeatureExtractor#
static create(
options: pycolmap.FeatureExtractionOptions | None = None,
device: pycolmap.Device = Device.auto,
) pycolmap.FeatureExtractor#
extract(
self: pycolmap.FeatureExtractor,
bitmap: pycolmap.Bitmap,
) tuple[pycolmap.FeatureKeypoints, pycolmap.FeatureDescriptors]#

Extract features from a Bitmap. Returns (FeatureKeypoints, FeatureDescriptors).

extract_from_uint8_array(
self: pycolmap.FeatureExtractor,
image: Annotated[numpy.typing.ArrayLike, numpy.uint8],
) tuple[pycolmap.FeatureKeypoints, pycolmap.FeatureDescriptors]#

Extract features from a uint8 numpy array with shape (H, W) or (H, W, 3). Returns (FeatureKeypoints, FeatureDescriptors).

extract_from_float32_array(
self: pycolmap.FeatureExtractor,
image: Annotated[numpy.typing.ArrayLike, numpy.float32],
) tuple[pycolmap.FeatureKeypoints, pycolmap.FeatureDescriptors]#

Extract features from a float32 numpy array with values in [0, 1] and shape (H, W) or (H, W, 3). Returns (FeatureKeypoints, FeatureDescriptors).

class pycolmap.Sift(
self: pycolmap.Sift,
options: pycolmap.FeatureExtractionOptions | None = None,
device: pycolmap.Device = Device.auto,
)#
extract(*args, **kwargs)#

Overloaded function.

  1. extract(self: pycolmap.Sift, image: typing.Annotated[numpy.typing.NDArray[numpy.uint8], "[m, n]", "flags.c_contiguous"]) tuple[typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, 4]"], typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]"]]

  2. extract(self: pycolmap.Sift, image: typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]", "flags.c_contiguous"]) tuple[typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, 4]"], typing.Annotated[numpy.typing.NDArray[numpy.float32], "[m, n]"]]

property options#
property device#
class pycolmap.FeatureMatcherType(self: pycolmap.FeatureMatcherType, value: SupportsInt | SupportsIndex)#

Members:

UNDEFINED

SIFT_BRUTEFORCE

SIFT_LIGHTGLUE

ALIKED_BRUTEFORCE

ALIKED_LIGHTGLUE

property name#
property value#
UNDEFINED = <FeatureMatcherType.UNDEFINED: -1>#
SIFT_BRUTEFORCE = <FeatureMatcherType.SIFT_BRUTEFORCE: 0>#
SIFT_LIGHTGLUE = <FeatureMatcherType.SIFT_LIGHTGLUE: 1>#
ALIKED_BRUTEFORCE = <FeatureMatcherType.ALIKED_BRUTEFORCE: 2>#
ALIKED_LIGHTGLUE = <FeatureMatcherType.ALIKED_LIGHTGLUE: 3>#
class pycolmap.SiftMatchingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.SiftMatchingOptions) None

  2. __init__(self: pycolmap.SiftMatchingOptions, arg0: dict) None

  3. __init__(self: pycolmap.SiftMatchingOptions, **kwargs) None

property max_ratio#

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

property max_distance#

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

property cross_check#

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

property cpu_brute_force_matcher#

Whether to use brute-force instead of faiss based CPU matching. (bool, default: False)

check(self: pycolmap.SiftMatchingOptions) bool#
summary(self: pycolmap.SiftMatchingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.SiftMatchingOptions, recursive: bool = True) dict#
class pycolmap.FeatureMatchingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.FeatureMatchingOptions, type: pycolmap.FeatureMatcherType = <FeatureMatcherType.SIFT_BRUTEFORCE: 0>) None

  2. __init__(self: pycolmap.FeatureMatchingOptions, arg0: dict) None

  3. __init__(self: pycolmap.FeatureMatchingOptions, **kwargs) None

property type#

(FeatureMatcherType, default: FeatureMatcherType.SIFT_BRUTEFORCE)

property num_threads#

(int, default: -1)

property use_gpu#

(bool, default: False)

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_num_matches#

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

property guided_matching#

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

property skip_geometric_verification#

Skips the geometric verification stage and forwards matches unchanged. Ignored when guided matching is enabled, because guided matching depends on the two-view geometry produced by geometric verification. (bool, default: False)

property rig_verification#

Whether to perform geometric verification using rig constraints between pairs of non-trivial frames. If disabled, performs geometric two-view verification for non-trivial frames without rig constraints. Ignored when skip_geometric_verification is enabled. (bool, default: False)

property skip_image_pairs_in_same_frame#

Whether to skip matching images within the same frame. This is useful for the case of non-overlapping cameras in a rig. (bool, default: False)

property sift#

(SiftMatchingOptions, default: SiftMatchingOptions(max_ratio=0.8, max_distance=0.7, cross_check=True, cpu_brute_force_matcher=False))

check(self: pycolmap.FeatureMatchingOptions) bool#
summary(self: pycolmap.FeatureMatchingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.FeatureMatchingOptions, recursive: bool = True) dict#
class pycolmap.FeatureMatcher#
static create(
options: pycolmap.FeatureMatchingOptions | None = None,
device: pycolmap.Device = Device.auto,
) pycolmap.FeatureMatcher#
match(
self: pycolmap.FeatureMatcher,
keypoints1: pycolmap.FeatureKeypoints,
descriptors1: pycolmap.FeatureDescriptors,
keypoints2: pycolmap.FeatureKeypoints,
descriptors2: pycolmap.FeatureDescriptors,
) Annotated[numpy.typing.NDArray[numpy.uint32], '[m, 2]']#

Match features between two images. Keypoints are optional. Returns an Nx2 matrix of point2D indices.

match_guided(
self: pycolmap.FeatureMatcher,
max_error: SupportsFloat | SupportsIndex,
keypoints1: pycolmap.FeatureKeypoints,
descriptors1: pycolmap.FeatureDescriptors,
camera1: pycolmap.Camera,
keypoints2: pycolmap.FeatureKeypoints,
descriptors2: pycolmap.FeatureDescriptors,
camera2: pycolmap.Camera,
two_view_geometry: pycolmap.TwoViewGeometry,
) None#

Perform guided matching using existing two-view geometry. Updates the two_view_geometry in-place.

class pycolmap.TrackElement(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.TrackElement) None

  2. __init__(self: pycolmap.TrackElement, image_id: typing.SupportsInt | typing.SupportsIndex, point2D_idx: typing.SupportsInt | typing.SupportsIndex) None

  3. __init__(self: pycolmap.TrackElement, arg0: dict) None

  4. __init__(self: pycolmap.TrackElement, **kwargs) None

property image_id#

(int, default: 4294967295)

property point2D_idx#

(int, default: 4294967295)

summary(self: pycolmap.TrackElement, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.TrackElement, recursive: bool = True) dict#
class pycolmap.Track(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Track) None

  2. __init__(self: pycolmap.Track, elements: collections.abc.Sequence[pycolmap.TrackElement]) None

  3. __init__(self: pycolmap.Track, arg0: dict) None

  4. __init__(self: pycolmap.Track, **kwargs) None

property elements#

(list, default: [])

length(self: pycolmap.Track) int#

Track Length.

add_element(*args, **kwargs)#

Overloaded function.

  1. add_element(self: pycolmap.Track, image_id: typing.SupportsInt | typing.SupportsIndex, point2D_idx: typing.SupportsInt | typing.SupportsIndex) None

Add an observation to the track.

  1. add_element(self: pycolmap.Track, element: pycolmap.TrackElement) None

add_elements(self: pycolmap.Track, elements: collections.abc.Sequence[pycolmap.TrackElement]) None#

Add multiple elements.

delete_element(*args, **kwargs)#

Overloaded function.

  1. delete_element(self: pycolmap.Track, image_id: typing.SupportsInt | typing.SupportsIndex, point2D_idx: typing.SupportsInt | typing.SupportsIndex) None

Delete observation from track.

  1. delete_element(self: pycolmap.Track, index: typing.SupportsInt | typing.SupportsIndex) None

Remove TrackElement at index.

element(self: pycolmap.Track, index: SupportsInt | SupportsIndex) pycolmap.TrackElement#

Access specific element by index.

set_element(
self: pycolmap.Track,
index: SupportsInt | SupportsIndex,
element: pycolmap.TrackElement,
) None#

Set element at specific index.

reserve(self: pycolmap.Track, num_elements: SupportsInt | SupportsIndex) None#

Reserve capacity for elements.

compress(self: pycolmap.Track) None#

Shrink capacity to fit size.

summary(self: pycolmap.Track, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Track, recursive: bool = True) dict#
class pycolmap.Point3D(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Point3D) None

  2. __init__(self: pycolmap.Point3D, arg0: dict) None

  3. __init__(self: pycolmap.Point3D, **kwargs) None

property xyz#

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

property color#

(ndarray, default: [0 0 0])

property error#

(float, default: -1.0)

property track#

(Track, default: Track(elements=[]))

has_error(self: pycolmap.Point3D) bool#

Check if error has been computed.

summary(self: pycolmap.Point3D, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Point3D, recursive: bool = True) dict#
class pycolmap.Point3DMap(self: pycolmap.Point3DMap)#
keys(self: pycolmap.Point3DMap) pycolmap.KeysView#
values(self: pycolmap.Point3DMap) pycolmap.ValuesView#
items(self: pycolmap.Point3DMap) pycolmap.ItemsView#
class pycolmap.Correspondence(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Correspondence) None

  2. __init__(self: pycolmap.Correspondence, image_id: typing.SupportsInt | typing.SupportsIndex, point2D_idx: typing.SupportsInt | typing.SupportsIndex) None

  3. __init__(self: pycolmap.Correspondence, arg0: dict) None

  4. __init__(self: pycolmap.Correspondence, **kwargs) None

property image_id#

(int, default: 4294967295)

property point2D_idx#

(int, default: 4294967295)

summary(self: pycolmap.Correspondence, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.Correspondence, recursive: bool = True) dict#
class pycolmap.CorrespondenceRange#
property empty#

Whether the range is empty.

to_list(self: pycolmap.CorrespondenceRange) list[pycolmap.Correspondence]#

Convert range to list of correspondences.

class pycolmap.CorrespondenceGraph(self: pycolmap.CorrespondenceGraph)#
finalize(self: pycolmap.CorrespondenceGraph) None#
num_images(self: pycolmap.CorrespondenceGraph) int#
num_image_pairs(self: pycolmap.CorrespondenceGraph) int#
num_observations_for_image(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
) int#
num_correspondences_for_image(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
) int#
num_matches_between_images(
self: pycolmap.CorrespondenceGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) int#
num_matches_between_all_images(self: pycolmap.CorrespondenceGraph) dict[int, int]#
exists_image(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
) bool#
image_pairs(self: pycolmap.CorrespondenceGraph) list[int]#
add_image(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
num_points2D: SupportsInt | SupportsIndex,
) None#
add_two_view_geometry(
self: pycolmap.CorrespondenceGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
two_view_geometry: pycolmap.TwoViewGeometry,
) None#
extract_correspondences(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) list[pycolmap.Correspondence]#
extract_transitive_correspondences(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
transitivity: SupportsInt | SupportsIndex,
) list[pycolmap.Correspondence]#
extract_matches_between_images(
self: pycolmap.CorrespondenceGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.uint32], '[m, 2]']#
extract_two_view_geometry(
self: pycolmap.CorrespondenceGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
extract_inlier_matches: bool,
) pycolmap.TwoViewGeometry#
has_correspondences(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) bool#
find_correspondences(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) pycolmap.CorrespondenceRange#

Find range of correspondences of an image observation.

is_two_view_observation(
self: pycolmap.CorrespondenceGraph,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) bool#
num_correspondences_between_images(*args, **kwargs) object#

Deprecated, use num_matches_between_images instead.

num_correspondences_between_all_images(*args, **kwargs) object#

Deprecated, use num_matches_between_all_images instead.

find_correspondences_between_images(*args, **kwargs) object#

Deprecated, use extract_matches_between_images instead.

class pycolmap.Database#
static open(path: os.PathLike | str | bytes) pycolmap.Database#
close(self: pycolmap.Database) None#
exists_rig(self: pycolmap.Database, rig_id: SupportsInt | SupportsIndex) bool#
exists_camera(self: pycolmap.Database, camera_id: SupportsInt | SupportsIndex) bool#
exists_frame(self: pycolmap.Database, frame_id: SupportsInt | SupportsIndex) bool#
exists_image(*args, **kwargs)#

Overloaded function.

  1. exists_image(self: pycolmap.Database, image_id: typing.SupportsInt | typing.SupportsIndex) bool

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

exists_pose_prior(
self: pycolmap.Database,
pose_prior_id: SupportsInt | SupportsIndex,
is_deprecated_image_prior: bool = True,
) bool#
exists_keypoints(self: pycolmap.Database, image_id: SupportsInt | SupportsIndex) bool#
exists_descriptors(self: pycolmap.Database, image_id: SupportsInt | SupportsIndex) bool#
exists_matches(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) bool#
exists_two_view_geometry(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) bool#
num_rigs(self: pycolmap.Database) int#
num_cameras(self: pycolmap.Database) int#
num_frames(self: pycolmap.Database) int#
num_images(self: pycolmap.Database) int#
num_pose_priors(self: pycolmap.Database) int#
num_keypoints(self: pycolmap.Database) int#
num_keypoints_for_image(self: pycolmap.Database, image_id: SupportsInt | SupportsIndex) int#
num_descriptors(self: pycolmap.Database) int#
num_descriptors_for_image(self: pycolmap.Database, image_id: SupportsInt | SupportsIndex) int#
num_matches(self: pycolmap.Database) int#
num_inlier_matches(self: pycolmap.Database) int#
num_matched_image_pairs(self: pycolmap.Database) int#
num_verified_image_pairs(self: pycolmap.Database) int#
read_rig(self: pycolmap.Database, rig_id: SupportsInt | SupportsIndex) pycolmap.Rig#
read_rig_with_sensor(self: pycolmap.Database, sensor_id: pycolmap.sensor_t) pycolmap.Rig | None#
read_all_rigs(self: pycolmap.Database) list[pycolmap.Rig]#
read_camera(self: pycolmap.Database, camera_id: SupportsInt | SupportsIndex) pycolmap.Camera#
read_all_cameras(self: pycolmap.Database) list[pycolmap.Camera]#
read_frame(self: pycolmap.Database, frame_id: SupportsInt | SupportsIndex) pycolmap.Frame#
read_all_frames(self: pycolmap.Database) list[pycolmap.Frame]#
read_image(self: pycolmap.Database, image_id: SupportsInt | SupportsIndex) pycolmap.Image#
read_image_with_name(self: pycolmap.Database, name: str) pycolmap.Image | None#
read_all_images(self: pycolmap.Database) list[pycolmap.Image]#
read_pose_prior(
self: pycolmap.Database,
pose_prior_id: SupportsInt | SupportsIndex,
is_deprecated_image_prior: bool = True,
) pycolmap.PosePrior#
read_all_pose_priors(self: pycolmap.Database) list[pycolmap.PosePrior]#
read_keypoints(
self: pycolmap.Database,
image_id: SupportsInt | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.float32], '[m, n]']#
read_descriptors(
self: pycolmap.Database,
image_id: SupportsInt | SupportsIndex,
) pycolmap.FeatureDescriptors#
read_matches(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.uint32], '[m, 2]']#
read_all_matches(
self: pycolmap.Database,
) tuple[list[int], list[Annotated[numpy.typing.NDArray[numpy.uint32], '[m, 2]']]]#
read_num_matches(self: pycolmap.Database) tuple[list[int], list[int]]#
read_two_view_geometry(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) pycolmap.TwoViewGeometry#
read_two_view_geometries(self: pycolmap.Database) tuple[list[int], list[pycolmap.TwoViewGeometry]]#
read_two_view_geometry_num_inliers(self: pycolmap.Database) tuple[list[int], list[int]]#
write_rig(self: pycolmap.Database, rig: pycolmap.Rig, use_rig_id: bool = False) int#
write_camera(self: pycolmap.Database, camera: pycolmap.Camera, use_camera_id: bool = False) int#
write_frame(self: pycolmap.Database, frame: pycolmap.Frame, use_frame_id: bool = False) int#
write_image(self: pycolmap.Database, image: pycolmap.Image, use_image_id: bool = False) int#
write_pose_prior(
self: pycolmap.Database,
pose_prior: pycolmap.PosePrior,
use_pose_prior_id: bool = False,
) int#
write_keypoints(
self: pycolmap.Database,
image_id: SupportsInt | SupportsIndex,
keypoints: Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]'],
) None#
write_descriptors(
self: pycolmap.Database,
image_id: SupportsInt | SupportsIndex,
descriptors: pycolmap.FeatureDescriptors,
) None#
write_matches(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
matches: Annotated[numpy.typing.ArrayLike, numpy.uint32, '[m, 2]'],
) None#
write_two_view_geometry(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
two_view_geometry: pycolmap.TwoViewGeometry,
) None#
update_rig(self: pycolmap.Database, rig: pycolmap.Rig) None#
update_camera(self: pycolmap.Database, camera: pycolmap.Camera) None#
update_frame(self: pycolmap.Database, frame: pycolmap.Frame) None#
update_image(self: pycolmap.Database, image: pycolmap.Image) None#
update_pose_prior(self: pycolmap.Database, pose_prior: pycolmap.PosePrior) None#
update_keypoints(
self: pycolmap.Database,
image_id: SupportsInt | SupportsIndex,
keypoints: Annotated[numpy.typing.ArrayLike, numpy.float32, '[m, n]'],
) None#
update_two_view_geometry(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
two_view_geometry: pycolmap.TwoViewGeometry,
) None#
delete_matches(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) None#
delete_two_view_geometry(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) None#
delete_inlier_matches(
self: pycolmap.Database,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) None#
clear_all_tables(self: pycolmap.Database) None#
clear_rigs(self: pycolmap.Database) None#
clear_cameras(self: pycolmap.Database) None#
clear_frames(self: pycolmap.Database) None#
clear_images(self: pycolmap.Database) None#
clear_pose_priors(self: pycolmap.Database) None#
clear_descriptors(self: pycolmap.Database) None#
clear_keypoints(self: pycolmap.Database) None#
clear_matches(self: pycolmap.Database) None#
clear_two_view_geometries(self: pycolmap.Database) None#
static merge(database1: pycolmap.Database, database2: pycolmap.Database, merged_database: pycolmap.Database) None#
class pycolmap.DatabaseTransaction(self: pycolmap.DatabaseTransaction, database: pycolmap.Database)#
class pycolmap.DatabaseCacheOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.DatabaseCacheOptions) None

  2. __init__(self: pycolmap.DatabaseCacheOptions, arg0: dict) None

  3. __init__(self: pycolmap.DatabaseCacheOptions, **kwargs) None

property min_num_matches#

Only load image pairs with a minimum number of matches. (int, default: 0)

property ignore_watermarks#

Whether to ignore watermark image pairs. (bool, default: False)

property image_names#

Only load the data for a subset of the images. All images are used if empty. (set, default: set())

property load_all_images#

Whether to load all candidate images regardless of whether they have correspondences. Only useful for triangulation. (bool, default: False)

property convert_pose_priors_to_enu#

Whether to convert pose priors to ENU coordinate system. (bool, default: False)

summary(self: pycolmap.DatabaseCacheOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.DatabaseCacheOptions, recursive: bool = True) dict#
class pycolmap.DatabaseCache(self: pycolmap.DatabaseCache)#
static create(database: pycolmap.Database, options: pycolmap.DatabaseCacheOptions) pycolmap.DatabaseCache#
static create_from_cache(
database_cache: pycolmap.DatabaseCache,
options: pycolmap.DatabaseCacheOptions,
) pycolmap.DatabaseCache#
load(
self: pycolmap.DatabaseCache,
database: pycolmap.Database,
options: pycolmap.DatabaseCacheOptions,
) None#
add_rig(self: pycolmap.DatabaseCache, arg0: pycolmap.Rig) None#
add_camera(self: pycolmap.DatabaseCache, arg0: pycolmap.Camera) None#
add_frame(self: pycolmap.DatabaseCache, arg0: pycolmap.Frame) None#
add_image(self: pycolmap.DatabaseCache, arg0: pycolmap.Image) None#
add_pose_prior(self: pycolmap.DatabaseCache, arg0: pycolmap.PosePrior) None#
num_rigs(self: pycolmap.DatabaseCache) int#
num_cameras(self: pycolmap.DatabaseCache) int#
num_frames(self: pycolmap.DatabaseCache) int#
num_images(self: pycolmap.DatabaseCache) int#
num_pose_priors(self: pycolmap.DatabaseCache) int#
exists_rig(self: pycolmap.DatabaseCache, rig_id: SupportsInt | SupportsIndex) bool#
exists_camera(self: pycolmap.DatabaseCache, camera_id: SupportsInt | SupportsIndex) bool#
exists_frame(self: pycolmap.DatabaseCache, frame_id: SupportsInt | SupportsIndex) bool#
exists_image(self: pycolmap.DatabaseCache, image_id: SupportsInt | SupportsIndex) bool#
rig(self: pycolmap.DatabaseCache, rig_id: SupportsInt | SupportsIndex) pycolmap.Rig#
camera(
self: pycolmap.DatabaseCache,
camera_id: SupportsInt | SupportsIndex,
) pycolmap.Camera#
frame(self: pycolmap.DatabaseCache, frame_id: SupportsInt | SupportsIndex) pycolmap.Frame#
image(self: pycolmap.DatabaseCache, image_id: SupportsInt | SupportsIndex) pycolmap.Image#
property rigs#
property cameras#
property frames#
property images#
property pose_priors#
property correspondence_graph#
find_image_with_name(self: pycolmap.DatabaseCache, name: str) pycolmap.Image#
class pycolmap.Reconstruction(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.Reconstruction) None

  2. __init__(self: pycolmap.Reconstruction, reconstruction: pycolmap.Reconstruction) None

  3. __init__(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None

read(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None#

Read reconstruction in COLMAP format. Prefer binary.

write(self: pycolmap.Reconstruction, output_dir: os.PathLike | str | bytes) None#

Write reconstruction in COLMAP binary format.

read_text(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None#
read_binary(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None#
write_text(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None#
write_binary(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None#
num_rigs(self: pycolmap.Reconstruction) int#
num_cameras(self: pycolmap.Reconstruction) int#
num_frames(self: pycolmap.Reconstruction) int#
num_reg_frames(self: pycolmap.Reconstruction) int#
num_images(self: pycolmap.Reconstruction) int#
num_reg_images(self: pycolmap.Reconstruction) int#
num_points3D(self: pycolmap.Reconstruction) int#
property rigs#
rig(self: pycolmap.Reconstruction, rig_id: SupportsInt | SupportsIndex) pycolmap.Rig#

Direct accessor for a rig.

property cameras#
camera(
self: pycolmap.Reconstruction,
camera_id: SupportsInt | SupportsIndex,
) pycolmap.Camera#

Direct accessor for a camera.

property frames#
frame(
self: pycolmap.Reconstruction,
frame_id: SupportsInt | SupportsIndex,
) pycolmap.Frame#

Direct accessor for a frame.

property images#
image(
self: pycolmap.Reconstruction,
image_id: SupportsInt | SupportsIndex,
) pycolmap.Image#

Direct accessor for an image.

property points3D#
point3D(
self: pycolmap.Reconstruction,
point3D_id: SupportsInt | SupportsIndex,
) pycolmap.Point3D#

Direct accessor for a Point3D.

reg_image_ids(self: pycolmap.Reconstruction) list[int]#
reg_frame_ids(self: pycolmap.Reconstruction) list[int]#
point3D_ids(self: pycolmap.Reconstruction) set[int]#
exists_rig(self: pycolmap.Reconstruction, rig_id: SupportsInt | SupportsIndex) bool#
exists_camera(
self: pycolmap.Reconstruction,
camera_id: SupportsInt | SupportsIndex,
) bool#
exists_frame(self: pycolmap.Reconstruction, frame_id: SupportsInt | SupportsIndex) bool#
exists_image(self: pycolmap.Reconstruction, image_id: SupportsInt | SupportsIndex) bool#
exists_point3D(
self: pycolmap.Reconstruction,
point3D_id: SupportsInt | SupportsIndex,
) bool#
is_valid(self: pycolmap.Reconstruction) bool#

Check whether the reconstruction object is internally consistent.

load(self: pycolmap.Reconstruction, database_cache: pycolmap.DatabaseCache) None#
tear_down(self: pycolmap.Reconstruction) None#
add_rig(self: pycolmap.Reconstruction, rig: pycolmap.Rig) None#

Add new rig.

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_camera_with_trivial_rig(self: pycolmap.Reconstruction, camera: pycolmap.Camera) None#

Add a new camera and also create a trivial rig whose rig_id matches the camera_id. The camera becomes the rig’s only sensor.

add_frame(self: pycolmap.Reconstruction, frame: pycolmap.Frame) None#

Add new frame.

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_image_with_trivial_frame(*args, **kwargs)#

Overloaded function.

  1. add_image_with_trivial_frame(self: pycolmap.Reconstruction, image: pycolmap.Image) None

Add a new image and create a frame with the same ID (frame_id = image_id). Assumes a rig exists whose rig_id equals the camera_id of the image.

  1. add_image_with_trivial_frame(self: pycolmap.Reconstruction, image: pycolmap.Image, cam_from_world: pycolmap.Rigid3d) None

Add a new image, create a trivial frame (frame_id = image_id), and also register the frame with an input pose.

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

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

add_point3D_with_id(
self: pycolmap.Reconstruction,
point3D_id: SupportsInt | SupportsIndex,
point3D: pycolmap.Point3D,
) None#

Add new 3D point with known ID.

add_observation(
self: pycolmap.Reconstruction,
point3D_id: SupportsInt | SupportsIndex,
track_element: pycolmap.TrackElement,
) None#

Add observation to existing 3D point.

merge_points3D(
self: pycolmap.Reconstruction,
point3D_id1: SupportsInt | SupportsIndex,
point3D_id2: SupportsInt | SupportsIndex,
) 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.

delete_point3D(
self: pycolmap.Reconstruction,
point3D_id: SupportsInt | SupportsIndex,
) None#

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

delete_observation(
self: pycolmap.Reconstruction,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) 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_all_points2D_and_points3D(self: pycolmap.Reconstruction) None#

Delete all 2D points of all images and all 3D points.

set_rigs_and_frames(
self: pycolmap.Reconstruction,
rigs: collections.abc.Sequence[pycolmap.Rig],
frames: collections.abc.Sequence[pycolmap.Frame],
) None#

Set rigs and frames together.

register_frame(
self: pycolmap.Reconstruction,
frame_id: SupportsInt | SupportsIndex,
) None#

Register an existing frame, and all its references.

deregister_frame(
self: pycolmap.Reconstruction,
frame_id: SupportsInt | SupportsIndex,
) None#

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

normalize(
self: pycolmap.Reconstruction,
fixed_scale: bool = False,
extent: SupportsFloat | SupportsIndex = 10.0,
min_percentile: SupportsFloat | SupportsIndex = 0.1,
max_percentile: SupportsFloat | SupportsIndex = 0.9,
use_images: bool = True,
) pycolmap.Sim3d#

Normalize scene by scaling and translation to avoid degenerate visualization after bundle adjustment and to improve numerical stability of algorithms.

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

Scales scene such that the minimum and maximum camera centers (or points) are at the given extent, whereas min_percentile and max_percentile determine the minimum and maximum percentiles of the camera centers (or points) considered.

transform(self: pycolmap.Reconstruction, new_from_old_world: pycolmap.Sim3d) None#

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

compute_centroid(
self: pycolmap.Reconstruction,
min_percentile: SupportsFloat | SupportsIndex = 0.0,
max_percentile: SupportsFloat | SupportsIndex = 1.0,
use_images: bool = False,
) Annotated[numpy.typing.NDArray[numpy.float64], '[3, 1]']#
compute_bounding_box(
self: pycolmap.Reconstruction,
min_percentile: SupportsFloat | SupportsIndex = 0.0,
max_percentile: SupportsFloat | SupportsIndex = 1.0,
use_images: bool = False,
) pycolmap.AlignedBox3d#
crop(self: pycolmap.Reconstruction, bbox: pycolmap.AlignedBox3d) pycolmap.Reconstruction#
find_image_with_name(self: pycolmap.Reconstruction, name: str) pycolmap.Image#

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

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.

transcribe_image_ids_to_database(self: pycolmap.Reconstruction, database: pycolmap.Database) None#

Update image identifiers to match the database by name.

update_point_3d_errors(self: pycolmap.Reconstruction) None#
compute_num_observations(self: pycolmap.Reconstruction) int#
compute_mean_track_length(self: pycolmap.Reconstruction) float#
compute_mean_observations_per_reg_image(self: pycolmap.Reconstruction) float#
compute_mean_reprojection_error(self: pycolmap.Reconstruction) float#
import_PLY(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None#

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

export_PLY(self: pycolmap.Reconstruction, output_path: os.PathLike | str | bytes) None#

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

extract_colors_for_image(
self: pycolmap.Reconstruction,
image_id: SupportsInt | SupportsIndex,
path: os.PathLike | str | bytes,
) 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.

extract_colors_for_all_images(
self: pycolmap.Reconstruction,
path: os.PathLike | str | bytes,
num_threads: SupportsInt | SupportsIndex = -1,
) None#

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

create_image_dirs(self: pycolmap.Reconstruction, path: os.PathLike | str | bytes) None#

Create all image sub-directories in the given path.

summary(self: pycolmap.Reconstruction) str#
class pycolmap.ReconstructionManager(self: pycolmap.ReconstructionManager)#
size(self: pycolmap.ReconstructionManager) int#
get(
self: pycolmap.ReconstructionManager,
idx: SupportsInt | SupportsIndex,
) pycolmap.Reconstruction#
add(self: pycolmap.ReconstructionManager) int#
delete(
self: pycolmap.ReconstructionManager,
idx: SupportsInt | SupportsIndex,
) None#
clear(self: pycolmap.ReconstructionManager) None#
read(self: pycolmap.ReconstructionManager, path: os.PathLike | str | bytes) int#
write(self: pycolmap.ReconstructionManager, path: os.PathLike | str | bytes) None#
class pycolmap.RigConfigCamera(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.RigConfigCamera) None

  2. __init__(self: pycolmap.RigConfigCamera, arg0: dict) None

  3. __init__(self: pycolmap.RigConfigCamera, **kwargs) None

property ref_sensor#

(bool, default: False)

property image_prefix#

(str, default: )

property cam_from_rig#

(NoneType, default: None)

property camera#

(NoneType, default: None)

summary(self: pycolmap.RigConfigCamera, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.RigConfigCamera, recursive: bool = True) dict#
class pycolmap.RigConfig(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.RigConfig) None

  2. __init__(self: pycolmap.RigConfig, arg0: dict) None

  3. __init__(self: pycolmap.RigConfig, **kwargs) None

property cameras#

(list, default: [])

summary(self: pycolmap.RigConfig, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.RigConfig, recursive: bool = True) dict#
pycolmap.read_rig_config(path: os.PathLike | str | bytes) list[pycolmap.RigConfig]#

Read the rig configuration from a .json file.

pycolmap.apply_rig_config(
configs: collections.abc.Sequence[pycolmap.RigConfig],
database: pycolmap.Database,
reconstruction: pycolmap.Reconstruction = None,
) None#

Applies the given rig configuration to the database and optionally derives camera rig extrinsics and intrinsics from the reconstruction, if not defined in the config. If the reconstruction is provided, it is also updated with the provided config and any previous rigs/frames are cleared and overwritten.

class pycolmap.SyntheticDatasetMatchConfig(*args, **kwargs)#

Members:

EXHAUSTIVE

CHAINED

SPARSE

Overloaded function.

  1. __init__(self: pycolmap.SyntheticDatasetMatchConfig, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.SyntheticDatasetMatchConfig, name: str) None

property name#
property value#
EXHAUSTIVE = SyntheticDatasetMatchConfig.EXHAUSTIVE#
CHAINED = SyntheticDatasetMatchConfig.CHAINED#
SPARSE = SyntheticDatasetMatchConfig.SPARSE#
class pycolmap.SyntheticDatasetOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.SyntheticDatasetOptions) None

  2. __init__(self: pycolmap.SyntheticDatasetOptions, arg0: dict) None

  3. __init__(self: pycolmap.SyntheticDatasetOptions, **kwargs) None

property feature_type#

The type of feature descriptors to synthesize. (FeatureExtractorType, default: FeatureExtractorType.SIFT)

property num_rigs#

(int, default: 2)

property num_cameras_per_rig#

(int, default: 1)

property num_frames_per_rig#

(int, default: 5)

property num_points3D#

(int, default: 100)

property track_length#

Target track length per 3D point. -1 = dense visibility (default), >= 2 = pruned observations. (int, default: -1)

property sensor_from_rig_translation_stddev#

(float, default: 0.05)

property sensor_from_rig_rotation_stddev#

Random rotation in degrees around the z-axis of the sensor. (float, default: 5.0)

property camera_width#

(int, default: 1024)

property camera_height#

(int, default: 768)

property camera_model_id#

(CameraModelId, default: CameraModelId.SIMPLE_RADIAL)

property camera_params#

(list, default: [1280.0, 512.0, 384.0, 0.05])

property camera_has_prior_focal_length#

(bool, default: False)

property num_points2D_without_point3D#

(int, default: 10)

property inlier_match_ratio#

(float, default: 1.0)

property two_view_geometry_has_relative_pose#

Whether to include decomposed relative poses in two-view geometries. (bool, default: False)

property match_config#

(SyntheticDatasetMatchConfig, default: SyntheticDatasetMatchConfig.EXHAUSTIVE)

property match_sparsity#

Sparsity parameter for SPARSE match config [0,1]. (float, default: 0.0)

property prior_position#

(bool, default: False)

property prior_gravity#

(bool, default: False)

property prior_position_coordinate_system#

(PosePriorCoordinateSystem, default: PosePriorCoordinateSystem.CARTESIAN)

property prior_gravity_in_world#

Prior gravity direction in world coordinates. (ndarray, default: [0. 1. 0.])

summary(self: pycolmap.SyntheticDatasetOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.SyntheticDatasetOptions, recursive: bool = True) dict#
pycolmap.synthesize_dataset(
options: pycolmap.SyntheticDatasetOptions,
database: pycolmap.Database = None,
) pycolmap.Reconstruction#
class pycolmap.SyntheticNoiseOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.SyntheticNoiseOptions) None

  2. __init__(self: pycolmap.SyntheticNoiseOptions, arg0: dict) None

  3. __init__(self: pycolmap.SyntheticNoiseOptions, **kwargs) None

property rig_from_world_translation_stddev#

(float, default: 0.0)

property rig_from_world_rotation_stddev#

Random rotation in degrees around the z-axis of the rig. (float, default: 0.0)

property point3D_stddev#

(float, default: 0.0)

property point2D_stddev#

(float, default: 0.0)

property prior_position_stddev#

(float, default: 1.5)

property prior_gravity_stddev#

(float, default: 1.0)

summary(self: pycolmap.SyntheticNoiseOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.SyntheticNoiseOptions, recursive: bool = True) dict#
pycolmap.synthesize_noise(
options: pycolmap.SyntheticNoiseOptions,
reconstruction: pycolmap.Reconstruction,
database: pycolmap.Database = None,
) None#
class pycolmap.SyntheticImageOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.SyntheticImageOptions) None

  2. __init__(self: pycolmap.SyntheticImageOptions, arg0: dict) None

  3. __init__(self: pycolmap.SyntheticImageOptions, **kwargs) None

property feature_peak_radius#

(int, default: 2)

property feature_patch_radius#

Random rotation in degrees around the z-axis of the rig. (int, default: 15)

property feature_patch_max_brightness#

(int, default: 128)

summary(self: pycolmap.SyntheticImageOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.SyntheticImageOptions, recursive: bool = True) dict#
pycolmap.synthesize_images(
options: pycolmap.SyntheticImageOptions,
reconstruction: pycolmap.Reconstruction,
image_path: os.PathLike | str | bytes,
) None#
class pycolmap.PoseGraphEdge(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.PoseGraphEdge) None

  2. __init__(self: pycolmap.PoseGraphEdge, cam2_from_cam1: pycolmap.Rigid3d) None

  3. __init__(self: pycolmap.PoseGraphEdge, arg0: dict) None

  4. __init__(self: pycolmap.PoseGraphEdge, **kwargs) None

property cam2_from_cam1#

Relative pose from image 1 to image 2. (Rigid3d, default: Rigid3d(rotation_xyzw=[0, 0, 0, 1], translation=[0, 0, 0]))

property num_matches#

Number of two-view matches used to compute the relative pose. (int, default: 0)

property valid#

Whether this edge is valid for reconstruction. (bool, default: True)

invert(self: pycolmap.PoseGraphEdge) None#

Invert the geometry to match swapped image order.

summary(self: pycolmap.PoseGraphEdge, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.PoseGraphEdge, recursive: bool = True) dict#
class pycolmap.PoseGraphEdgeMap(self: pycolmap.PoseGraphEdgeMap)#
keys(self: pycolmap.PoseGraphEdgeMap) pycolmap.KeysView#
values(self: pycolmap.PoseGraphEdgeMap) pycolmap.ValuesView#
items(self: pycolmap.PoseGraphEdgeMap) pycolmap.ItemsView#
class pycolmap.PoseGraph(self: pycolmap.PoseGraph)#
property edges#

Access to all edges in the pose graph.

property num_edges#

Number of edges in the pose graph.

property empty#

Whether the pose graph has no edges.

clear(self: pycolmap.PoseGraph) None#

Remove all edges.

load(self: pycolmap.PoseGraph, corr_graph: pycolmap.CorrespondenceGraph) None#

Load edges from a correspondence graph.

add_edge(
self: pycolmap.PoseGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
edge: pycolmap.PoseGraphEdge,
) pycolmap.PoseGraphEdge#

Add a new edge between two images. Throws if edge already exists.

has_edge(
self: pycolmap.PoseGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) bool#

Check if an edge exists between two images.

get_edge(
self: pycolmap.PoseGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) pycolmap.PoseGraphEdge#

Get a copy of the edge between two images. Automatically handles geometric inversion if image order was swapped.

delete_edge(
self: pycolmap.PoseGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) bool#

Delete the edge between two images. Returns True if deleted.

update_edge(
self: pycolmap.PoseGraph,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
edge: pycolmap.PoseGraphEdge,
) None#

Update an existing edge. Throws if edge does not exist.

is_valid(self: pycolmap.PoseGraph, pair_id: SupportsInt | SupportsIndex) bool#

Check if an edge is marked as valid.

set_valid_edge(self: pycolmap.PoseGraph, pair_id: SupportsInt | SupportsIndex) None#

Mark an edge as valid.

set_invalid_edge(self: pycolmap.PoseGraph, pair_id: SupportsInt | SupportsIndex) None#

Mark an edge as invalid.

compute_largest_connected_frame_component(
self: pycolmap.PoseGraph,
reconstruction: pycolmap.Reconstruction,
filter_unregistered: bool = True,
) set[int]#

Compute the largest connected component of frames. If filter_unregistered is True, only considers frames with poses.

invalidate_pairs_outside_active_image_ids(
self: pycolmap.PoseGraph,
active_image_ids: collections.abc.Set[SupportsInt | SupportsIndex],
) None#

Mark image pairs as invalid if either image is not in the active set.

mark_connected_components(
self: pycolmap.PoseGraph,
reconstruction: pycolmap.Reconstruction,
min_num_images: SupportsInt | SupportsIndex = -1,
) dict#

Mark connected clusters of images. Returns dict with num_components and cluster_ids mapping frame IDs to cluster IDs.

class pycolmap.UndistortCameraOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.UndistortCameraOptions) None

  2. __init__(self: pycolmap.UndistortCameraOptions, arg0: dict) None

  3. __init__(self: pycolmap.UndistortCameraOptions, **kwargs) None

property blank_pixels#

(float, default: 0.0)

property min_scale#

(float, default: 0.2)

property max_scale#

(float, default: 2.0)

property max_image_size#

(int, default: -1)

property roi_min_x#

(float, default: 0.0)

property roi_min_y#

(float, default: 0.0)

property roi_max_x#

(float, default: 1.0)

property roi_max_y#

(float, default: 1.0)

property max_cam_point_norm#

(float, default: -1.0)

summary(self: pycolmap.UndistortCameraOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.UndistortCameraOptions, recursive: bool = True) dict#
pycolmap.undistort_camera(options: pycolmap.UndistortCameraOptions, camera: pycolmap.Camera) pycolmap.Camera#

Undistort camera.

pycolmap.undistort_image(
options: pycolmap.UndistortCameraOptions,
distorted_image: pycolmap.Bitmap,
distorted_camera: pycolmap.Camera,
) tuple[pycolmap.Bitmap, pycolmap.Camera]#

Undistort image and corresponding camera.

class pycolmap.AbsolutePoseEstimationOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.AbsolutePoseEstimationOptions) None

  2. __init__(self: pycolmap.AbsolutePoseEstimationOptions, arg0: dict) None

  3. __init__(self: pycolmap.AbsolutePoseEstimationOptions, **kwargs) None

property estimate_focal_length#

(bool, default: False)

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, random_seed=-1, num_threads=1))

summary(self: pycolmap.AbsolutePoseEstimationOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.AbsolutePoseEstimationOptions, recursive: bool = True) dict#
class pycolmap.AbsolutePoseRefinementOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.AbsolutePoseRefinementOptions) None

  2. __init__(self: pycolmap.AbsolutePoseRefinementOptions, arg0: dict) None

  3. __init__(self: pycolmap.AbsolutePoseRefinementOptions, **kwargs) None

property gradient_tolerance#

(float, default: 1.0)

property max_num_iterations#

(int, default: 100)

property loss_function_scale#

(float, default: 1.0)

property refine_focal_length#

(bool, default: False)

property refine_extra_params#

(bool, default: False)

property print_summary#

(bool, default: False)

property use_position_prior#

(bool, default: False)

property position_prior_in_world#

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

property position_prior_covariance#

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

summary(self: pycolmap.AbsolutePoseRefinementOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.AbsolutePoseRefinementOptions, recursive: bool = True) dict#
pycolmap.estimate_absolute_pose(
points2D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
camera: pycolmap.Camera,
estimation_options: pycolmap.AbsolutePoseEstimationOptions = AbsolutePoseEstimationOptions(),
) dict | None#

Robustly estimate absolute pose using LO-RANSAC without non-linear refinement.

pycolmap.refine_absolute_pose(
cam_from_world: pycolmap.Rigid3d,
points2D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
inlier_mask: Annotated[numpy.typing.ArrayLike, numpy.bool, '[m, 1]'],
camera: pycolmap.Camera,
refinement_options: pycolmap.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(),
return_covariance: bool = False,
) dict | None#

Non-linear refinement of absolute pose.

pycolmap.estimate_and_refine_absolute_pose(
points2D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
camera: pycolmap.Camera,
estimation_options: pycolmap.AbsolutePoseEstimationOptions = AbsolutePoseEstimationOptions(),
refinement_options: pycolmap.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(),
return_covariance: bool = False,
) dict | None#

Robust absolute pose estimation with LO-RANSAC followed by non-linear refinement.

pycolmap.estimate_relative_pose(
cam_rays1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
cam_rays2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None#

Robustly estimate relative pose using LO-RANSAC without non-linear refinement.

pycolmap.refine_relative_pose(
cam2_from_cam1: pycolmap.Rigid3d,
cam_rays1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
cam_rays2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
inlier_mask: Annotated[numpy.typing.ArrayLike, numpy.bool, '[m, 1]'],
options: pycolmap.pyceres.SolverOptions = SolverOptions(minimizer_type=MinimizerType.TRUST_REGION, line_search_direction_type=LineSearchDirectionType.LBFGS, line_search_type=LineSearchType.WOLFE, nonlinear_conjugate_gradient_type=NonlinearConjugateGradientType.FLETCHER_REEVES, max_lbfgs_rank=20, use_approximate_eigenvalue_bfgs_scaling=False, line_search_interpolation_type=LineSearchInterpolationType.CUBIC, min_line_search_step_size=1e-09, line_search_sufficient_function_decrease=0.0001, max_line_search_step_contraction=0.001, min_line_search_step_contraction=0.6, max_num_line_search_step_size_iterations=20, max_num_line_search_direction_restarts=5, line_search_sufficient_curvature_decrease=0.9, max_line_search_step_expansion=10.0, trust_region_strategy_type=TrustRegionStrategyType.LEVENBERG_MARQUARDT, dogleg_type=DoglegType.TRADITIONAL_DOGLEG, use_nonmonotonic_steps=False, max_consecutive_nonmonotonic_steps=5, max_num_iterations=50, max_solver_time_in_seconds=1000000000.0, num_threads=1, initial_trust_region_radius=10000.0, max_trust_region_radius=1e+16, min_trust_region_radius=1e-32, min_relative_decrease=0.001, min_lm_diagonal=1e-06, max_lm_diagonal=1e+32, max_num_consecutive_invalid_steps=5, function_tolerance=1e-06, gradient_tolerance=1e-10, parameter_tolerance=1e-08, linear_solver_type=LinearSolverType.SPARSE_NORMAL_CHOLESKY, preconditioner_type=PreconditionerType.JACOBI, visibility_clustering_type=VisibilityClusteringType.CANONICAL_VIEWS, dense_linear_algebra_library_type=DenseLinearAlgebraLibraryType.EIGEN, sparse_linear_algebra_library_type=SparseLinearAlgebraLibraryType.SUITE_SPARSE, use_explicit_schur_complement=False, dynamic_sparsity=False, use_inner_iterations=False, inner_iteration_tolerance=0.001, min_linear_solver_iterations=0, max_linear_solver_iterations=500, eta=0.1, jacobi_scaling=True, logging_type=LoggingType.PER_MINIMIZER_ITERATION, minimizer_progress_to_stdout=False, trust_region_problem_dump_directory='/tmp', trust_region_problem_dump_format_type=DumpFormatType.TEXTFILE, check_gradients=False, gradient_check_relative_precision=1e-08, gradient_check_numeric_derivative_relative_step_size=1e-06, update_state_every_iteration=False),
) dict | None#

Non-linear refinement of relative pose.

pycolmap.estimate_affine2d(
src: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
tgt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
) Annotated[numpy.typing.NDArray[numpy.float64], '[2, 3]'] | None#

Estimate the 2D affine transform tgt_from_src.

pycolmap.estimate_affine2d_robust(
src: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
tgt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None#

Robustly estimate the 2D affine transform tgt_from_src using LO-RANSAC.

class pycolmap.ImageAlignmentError(self: pycolmap.ImageAlignmentError)#
property image_name#
property rotation_error_deg#
property proj_center_error#
pycolmap.align_reconstructions_via_reprojections(
src_reconstruction: pycolmap.Reconstruction,
tgt_reconstruction: pycolmap.Reconstruction,
min_inlier_observations: SupportsFloat | SupportsIndex = 0.3,
max_reproj_error: SupportsFloat | SupportsIndex = 8.0,
) pycolmap.Sim3d | None#
pycolmap.align_reconstructions_via_proj_centers(
src_reconstruction: pycolmap.Reconstruction,
tgt_reconstruction: pycolmap.Reconstruction,
max_proj_center_error: SupportsFloat | SupportsIndex,
) pycolmap.Sim3d | None#
pycolmap.align_reconstructions_via_points(
src_reconstruction: pycolmap.Reconstruction,
tgt_reconstruction: pycolmap.Reconstruction,
min_common_observations: SupportsInt | SupportsIndex = 3,
max_error: SupportsFloat | SupportsIndex = 0.005,
min_inlier_ratio: SupportsFloat | SupportsIndex = 0.9,
) pycolmap.Sim3d | None#
pycolmap.align_reconstruction_to_locations(
src: pycolmap.Reconstruction,
tgt_image_names: collections.abc.Sequence[str],
tgt_locations: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
min_common_images: SupportsInt | SupportsIndex,
ransac_options: pycolmap.RANSACOptions,
) pycolmap.Sim3d | None#
pycolmap.compare_reconstructions(
reconstruction1: pycolmap.Reconstruction,
reconstruction2: pycolmap.Reconstruction,
alignment_error: str = 'reprojection',
min_inlier_observations: SupportsFloat | SupportsIndex = 0.3,
max_reproj_error: SupportsFloat | SupportsIndex = 8.0,
max_proj_center_error: SupportsFloat | SupportsIndex = 0.1,
) dict | None#
pycolmap.align_reconstruction_to_orig_rig_scales(orig_rigs: pycolmap.RigMap, reconstruction: pycolmap.Reconstruction) bool#
class pycolmap.BundleAdjustmentTerminationType(*args, **kwargs)#

Members:

CONVERGENCE

NO_CONVERGENCE

FAILURE

USER_SUCCESS

USER_FAILURE

Overloaded function.

  1. __init__(self: pycolmap.BundleAdjustmentTerminationType, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.BundleAdjustmentTerminationType, name: str) None

property name#
property value#
CONVERGENCE = BundleAdjustmentTerminationType.CONVERGENCE#
NO_CONVERGENCE = BundleAdjustmentTerminationType.NO_CONVERGENCE#
FAILURE = BundleAdjustmentTerminationType.FAILURE#
USER_SUCCESS = BundleAdjustmentTerminationType.USER_SUCCESS#
USER_FAILURE = BundleAdjustmentTerminationType.USER_FAILURE#
class pycolmap.BundleAdjustmentSummary(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.BundleAdjustmentSummary) None

  2. __init__(self: pycolmap.BundleAdjustmentSummary, arg0: dict) None

  3. __init__(self: pycolmap.BundleAdjustmentSummary, **kwargs) None

property termination_type#

(BundleAdjustmentTerminationType, default: BundleAdjustmentTerminationType.FAILURE) (BundleAdjustmentTerminationType, default: BundleAdjustmentTerminationType.FAILURE)

property num_residuals#

(int, default: 0) (int, default: 0)

is_solution_usable(self: pycolmap.BundleAdjustmentSummary) bool#
brief_report(self: pycolmap.BundleAdjustmentSummary) str#
summary(self: pycolmap.BundleAdjustmentSummary, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.BundleAdjustmentSummary, recursive: bool = True) dict#
class pycolmap.CeresBundleAdjustmentSummary(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.CeresBundleAdjustmentSummary) None

  2. __init__(self: pycolmap.CeresBundleAdjustmentSummary, arg0: dict) None

  3. __init__(self: pycolmap.CeresBundleAdjustmentSummary, **kwargs) None

property ceres_summary#

Full Ceres solver summary. (SolverSummary, default: SolverSummary(minimizer_type=MinimizerType.TRUST_REGION, termination_type=TerminationType.FAILURE, message=’ceres::Solve was not called.’, initial_cost=-1.0, final_cost=-1.0, fixed_cost=-1.0, num_successful_steps=-1, num_unsuccessful_steps=-1, num_inner_iteration_steps=-1, num_line_search_steps=-1, preprocessor_time_in_seconds=-1.0, minimizer_time_in_seconds=-1.0, postprocessor_time_in_seconds=-1.0, total_time_in_seconds=-1.0, linear_solver_time_in_seconds=-1.0, num_linear_solves=-1, residual_evaluation_time_in_seconds=-1.0, num_residual_evaluations=-1, jacobian_evaluation_time_in_seconds=-1.0, num_jacobian_evaluations=-1, inner_iteration_time_in_seconds=-1.0, line_search_cost_evaluation_time_in_seconds=-1.0, line_search_gradient_evaluation_time_in_seconds=-1.0, line_search_polynomial_minimization_time_in_seconds=-1.0, line_search_total_time_in_seconds=-1.0, num_parameter_blocks=-1, num_parameters=-1, num_effective_parameters=-1, num_residual_blocks=-1, num_residuals=-1, num_parameter_blocks_reduced=-1, num_parameters_reduced=-1, num_effective_parameters_reduced=-1, num_residual_blocks_reduced=-1, num_residuals_reduced=-1, is_constrained=False, num_threads_given=-1, num_threads_used=-1, linear_solver_type_given=LinearSolverType.SPARSE_NORMAL_CHOLESKY, linear_solver_type_used=LinearSolverType.SPARSE_NORMAL_CHOLESKY, schur_structure_given=’’, schur_structure_used=’’, inner_iterations_given=False, inner_iterations_used=False, preconditioner_type_given=PreconditionerType.IDENTITY, preconditioner_type_used=PreconditionerType.IDENTITY, visibility_clustering_type=VisibilityClusteringType.CANONICAL_VIEWS, trust_region_strategy_type=TrustRegionStrategyType.LEVENBERG_MARQUARDT, dogleg_type=DoglegType.TRADITIONAL_DOGLEG, dense_linear_algebra_library_type=DenseLinearAlgebraLibraryType.EIGEN, sparse_linear_algebra_library_type=SparseLinearAlgebraLibraryType.NO_SPARSE, line_search_direction_type=LineSearchDirectionType.LBFGS, line_search_type=LineSearchType.WOLFE, line_search_interpolation_type=LineSearchInterpolationType.CUBIC, nonlinear_conjugate_gradient_type=NonlinearConjugateGradientType.FLETCHER_REEVES, max_lbfgs_rank=-1))

mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.CeresBundleAdjustmentSummary, recursive: bool = True) dict#
class pycolmap.BundleAdjustmentGauge(*args, **kwargs)#

Members:

UNSPECIFIED

TWO_CAMS_FROM_WORLD

THREE_POINTS

Overloaded function.

  1. __init__(self: pycolmap.BundleAdjustmentGauge, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.BundleAdjustmentGauge, name: str) None

property name#
property value#
UNSPECIFIED = BundleAdjustmentGauge.UNSPECIFIED#
TWO_CAMS_FROM_WORLD = BundleAdjustmentGauge.TWO_CAMS_FROM_WORLD#
THREE_POINTS = BundleAdjustmentGauge.THREE_POINTS#
class pycolmap.BundleAdjustmentBackend(*args, **kwargs)#

Members:

CERES

CASPAR

Overloaded function.

  1. __init__(self: pycolmap.BundleAdjustmentBackend, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.BundleAdjustmentBackend, name: str) None

property name#
property value#
CERES = BundleAdjustmentBackend.CERES#
CASPAR = BundleAdjustmentBackend.CASPAR#
class pycolmap.BundleAdjustmentConfig(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.BundleAdjustmentConfig) None

  2. __init__(self: pycolmap.BundleAdjustmentConfig, arg0: dict) None

  3. __init__(self: pycolmap.BundleAdjustmentConfig, **kwargs) None

fix_gauge(self: pycolmap.BundleAdjustmentConfig, arg0: pycolmap.BundleAdjustmentGauge) None#
property fixed_gauge#

(BundleAdjustmentGauge, default: BundleAdjustmentGauge.UNSPECIFIED)

num_points(self: pycolmap.BundleAdjustmentConfig) int#
num_constant_cam_intrinsics(self: pycolmap.BundleAdjustmentConfig) int#
num_constant_sensor_from_rig_poses(self: pycolmap.BundleAdjustmentConfig) int#
num_constant_rig_from_world_poses(self: pycolmap.BundleAdjustmentConfig) int#
num_variable_points(self: pycolmap.BundleAdjustmentConfig) int#
num_constant_points(self: pycolmap.BundleAdjustmentConfig) int#
num_residuals(
self: pycolmap.BundleAdjustmentConfig,
reconstruction: pycolmap.Reconstruction,
) int#
add_image(
self: pycolmap.BundleAdjustmentConfig,
image_id: SupportsInt | SupportsIndex,
) None#
has_image(
self: pycolmap.BundleAdjustmentConfig,
image_id: SupportsInt | SupportsIndex,
) bool#
remove_image(
self: pycolmap.BundleAdjustmentConfig,
image_id: SupportsInt | SupportsIndex,
) None#
set_constant_cam_intrinsics(
self: pycolmap.BundleAdjustmentConfig,
camera_id: SupportsInt | SupportsIndex,
) None#
set_variable_cam_intrinsics(
self: pycolmap.BundleAdjustmentConfig,
camera_id: SupportsInt | SupportsIndex,
) None#
has_constant_cam_intrinsics(
self: pycolmap.BundleAdjustmentConfig,
camera_id: SupportsInt | SupportsIndex,
) bool#
set_constant_sensor_from_rig_pose(
self: pycolmap.BundleAdjustmentConfig,
sensor_id: pycolmap.sensor_t,
) None#
set_variable_sensor_from_rig_pose(
self: pycolmap.BundleAdjustmentConfig,
sensor_id: pycolmap.sensor_t,
) None#
has_constant_sensor_from_rig_pose(
self: pycolmap.BundleAdjustmentConfig,
sensor_id: pycolmap.sensor_t,
) bool#
set_constant_rig_from_world_pose(
self: pycolmap.BundleAdjustmentConfig,
frame_id: SupportsInt | SupportsIndex,
) None#
set_variable_rig_from_world_pose(
self: pycolmap.BundleAdjustmentConfig,
frame_id: SupportsInt | SupportsIndex,
) None#
has_constant_rig_from_world_pose(
self: pycolmap.BundleAdjustmentConfig,
frame_id: SupportsInt | SupportsIndex,
) bool#
add_variable_point(
self: pycolmap.BundleAdjustmentConfig,
point3D_id: SupportsInt | SupportsIndex,
) None#
add_constant_point(
self: pycolmap.BundleAdjustmentConfig,
point3D_id: SupportsInt | SupportsIndex,
) None#
has_point(
self: pycolmap.BundleAdjustmentConfig,
point3D_id: SupportsInt | SupportsIndex,
) bool#
has_variable_point(
self: pycolmap.BundleAdjustmentConfig,
point3D_id: SupportsInt | SupportsIndex,
) bool#
has_constant_point(
self: pycolmap.BundleAdjustmentConfig,
point3D_id: SupportsInt | SupportsIndex,
) bool#
remove_variable_point(
self: pycolmap.BundleAdjustmentConfig,
point3D_id: SupportsInt | SupportsIndex,
) None#
remove_constant_point(
self: pycolmap.BundleAdjustmentConfig,
point3D_id: SupportsInt | SupportsIndex,
) None#
property constant_cam_intrinsics#

(set, default: set())

property images#

(set, default: set())

property variable_points#

(set, default: set())

property constant_points#

(set, default: set())

property constant_sensor_from_rig_poses#

(set, default: set())

property constant_rig_from_world_poses#

(set, default: set())

summary(self: pycolmap.BundleAdjustmentConfig, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.BundleAdjustmentConfig, recursive: bool = True) dict#
class pycolmap.LossFunctionType(*args, **kwargs)#

Members:

TRIVIAL

SOFT_L1

CAUCHY

HUBER

Overloaded function.

  1. __init__(self: pycolmap.LossFunctionType, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.LossFunctionType, name: str) None

property name#
property value#
TRIVIAL = LossFunctionType.TRIVIAL#
SOFT_L1 = LossFunctionType.SOFT_L1#
CAUCHY = LossFunctionType.CAUCHY#
HUBER = LossFunctionType.HUBER#
class pycolmap.CeresBundleAdjustmentOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.CeresBundleAdjustmentOptions) None

  2. __init__(self: pycolmap.CeresBundleAdjustmentOptions, arg0: dict) None

  3. __init__(self: pycolmap.CeresBundleAdjustmentOptions, **kwargs) None

create_loss_function(self: pycolmap.CeresBundleAdjustmentOptions) ceres::LossFunction#
create_solver_options(
self: pycolmap.CeresBundleAdjustmentOptions,
config: pycolmap.BundleAdjustmentConfig,
problem: ceres::Problem,
) pycolmap.pyceres.SolverOptions#
property loss_function_type#

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

property loss_function_scale#

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

property use_gpu#

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

property gpu_index#

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

property solver_options#

Options for the Ceres solver. Using this member requires having PyCeres installed. (SolverOptions, default: SolverOptions(minimizer_type=MinimizerType.TRUST_REGION, line_search_direction_type=LineSearchDirectionType.LBFGS, line_search_type=LineSearchType.WOLFE, nonlinear_conjugate_gradient_type=NonlinearConjugateGradientType.FLETCHER_REEVES, max_lbfgs_rank=20, use_approximate_eigenvalue_bfgs_scaling=False, line_search_interpolation_type=LineSearchInterpolationType.CUBIC, min_line_search_step_size=1e-09, line_search_sufficient_function_decrease=0.0001, max_line_search_step_contraction=0.001, min_line_search_step_contraction=0.6, max_num_line_search_step_size_iterations=20, max_num_line_search_direction_restarts=5, line_search_sufficient_curvature_decrease=0.9, max_line_search_step_expansion=10.0, trust_region_strategy_type=TrustRegionStrategyType.LEVENBERG_MARQUARDT, dogleg_type=DoglegType.TRADITIONAL_DOGLEG, use_nonmonotonic_steps=False, max_consecutive_nonmonotonic_steps=10, max_num_iterations=100, max_solver_time_in_seconds=1000000000.0, num_threads=-1, initial_trust_region_radius=10000.0, max_trust_region_radius=1e+16, min_trust_region_radius=1e-32, min_relative_decrease=0.001, min_lm_diagonal=1e-06, max_lm_diagonal=1e+32, max_num_consecutive_invalid_steps=10, function_tolerance=0.0, gradient_tolerance=0.0001, parameter_tolerance=0.0, linear_solver_type=LinearSolverType.SPARSE_NORMAL_CHOLESKY, preconditioner_type=PreconditionerType.JACOBI, visibility_clustering_type=VisibilityClusteringType.CANONICAL_VIEWS, dense_linear_algebra_library_type=DenseLinearAlgebraLibraryType.EIGEN, sparse_linear_algebra_library_type=SparseLinearAlgebraLibraryType.SUITE_SPARSE, use_explicit_schur_complement=False, dynamic_sparsity=False, use_inner_iterations=False, inner_iteration_tolerance=0.001, min_linear_solver_iterations=0, max_linear_solver_iterations=200, eta=0.1, jacobi_scaling=True, logging_type=LoggingType.SILENT, minimizer_progress_to_stdout=False, trust_region_problem_dump_directory=’/tmp’, trust_region_problem_dump_format_type=DumpFormatType.TEXTFILE, check_gradients=False, gradient_check_relative_precision=1e-08, gradient_check_numeric_derivative_relative_step_size=1e-06, update_state_every_iteration=False))

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 max_num_images_direct_dense_cpu_solver#

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

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_dense_gpu_solver#

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

property max_num_images_direct_sparse_gpu_solver#

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

property auto_select_solver_type#

Whether to automatically select solver type based on problem size. When False, uses the linear_solver_type and preconditioner_type from solver_options directly. (bool, default: True)

check(self: pycolmap.CeresBundleAdjustmentOptions) bool#
summary(self: pycolmap.CeresBundleAdjustmentOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.CeresBundleAdjustmentOptions, recursive: bool = True) dict#
class pycolmap.CasparBundleAdjustmentOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.CasparBundleAdjustmentOptions) None

  2. __init__(self: pycolmap.CasparBundleAdjustmentOptions, arg0: dict) None

  3. __init__(self: pycolmap.CasparBundleAdjustmentOptions, **kwargs) None

property solver_iter_max#

Maximum number of Caspar solver iterations. (int, default: 200)

property pcg_iter_max#

Maximum number of PCG iterations per solver step. (int, default: 20)

property diag_init#

Initial diagonal damping value. (float, default: 1.0)

property diag_min#

Minimum diagonal damping value. (float, default: 1e-12)

property diag_scaling_up#

Diagonal damping increase factor. (float, default: 2.0)

property diag_scaling_down#

Diagonal damping decrease factor. (float, default: 0.333333)

property diag_exit_value#

Diagonal damping value that triggers termination. (float, default: 1000.0)

property score_exit_value#

Score threshold that triggers termination. (float, default: 0.0)

property pcg_rel_error_exit#

Relative PCG error threshold that triggers exit. (float, default: 0.0001)

property pcg_rel_score_exit#

Relative PCG score threshold that triggers exit. (float, default: -1.0)

property pcg_rel_decrease_min#

Minimum relative PCG decrease. (float, default: -1.0)

property solver_rel_decrease_min#

Minimum relative solver decrease. (float, default: 1.0)

property gpu_index#

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

summary(self: pycolmap.CasparBundleAdjustmentOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.CasparBundleAdjustmentOptions, recursive: bool = True) dict#
class pycolmap.BundleAdjustmentOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.BundleAdjustmentOptions) None

  2. __init__(self: pycolmap.BundleAdjustmentOptions, arg0: dict) None

  3. __init__(self: pycolmap.BundleAdjustmentOptions, **kwargs) None

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 refine_extra_params#

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

property refine_rig_from_world#

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

property refine_sensor_from_rig#

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

property constant_rig_from_world_rotation#

Whether to keep the rotation component of rig_from_world constant. Only takes effect when refine_rig_from_world is true. (bool, default: False)

property refine_points3D#

Whether to refine 3D points. (bool, default: True)

property min_track_length#

Minimum track length for a 3D point. (int, default: 0)

property print_summary#

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

property backend#

Solver backend to use for bundle adjustment. (BundleAdjustmentBackend, default: BundleAdjustmentBackend.CERES)

property ceres#

Ceres-specific bundle adjustment options. (CeresBundleAdjustmentOptions, default: CeresBundleAdjustmentOptions(loss_function_type=LossFunctionType.TRIVIAL, loss_function_scale=1.0, use_gpu=False, gpu_index=’-1’, solver_options=SolverOptions(minimizer_type=MinimizerType.TRUST_REGION, line_search_direction_type=LineSearchDirectionType.LBFGS, line_search_type=LineSearchType.WOLFE, nonlinear_conjugate_gradient_type=NonlinearConjugateGradientType.FLETCHER_REEVES, max_lbfgs_rank=20, use_approximate_eigenvalue_bfgs_scaling=False, line_search_interpolation_type=LineSearchInterpolationType.CUBIC, min_line_search_step_size=1e-09, line_search_sufficient_function_decrease=0.0001, max_line_search_step_contraction=0.001, min_line_search_step_contraction=0.6, max_num_line_search_step_size_iterations=20, max_num_line_search_direction_restarts=5, line_search_sufficient_curvature_decrease=0.9, max_line_search_step_expansion=10.0, trust_region_strategy_type=TrustRegionStrategyType.LEVENBERG_MARQUARDT, dogleg_type=DoglegType.TRADITIONAL_DOGLEG, use_nonmonotonic_steps=False, max_consecutive_nonmonotonic_steps=10, max_num_iterations=100, max_solver_time_in_seconds=1000000000.0, num_threads=-1, initial_trust_region_radius=10000.0, max_trust_region_radius=1e+16, min_trust_region_radius=1e-32, min_relative_decrease=0.001, min_lm_diagonal=1e-06, max_lm_diagonal=1e+32, max_num_consecutive_invalid_steps=10, function_tolerance=0.0, gradient_tolerance=0.0001, parameter_tolerance=0.0, linear_solver_type=LinearSolverType.SPARSE_NORMAL_CHOLESKY, preconditioner_type=PreconditionerType.JACOBI, visibility_clustering_type=VisibilityClusteringType.CANONICAL_VIEWS, dense_linear_algebra_library_type=DenseLinearAlgebraLibraryType.EIGEN, sparse_linear_algebra_library_type=SparseLinearAlgebraLibraryType.SUITE_SPARSE, use_explicit_schur_complement=False, dynamic_sparsity=False, use_inner_iterations=False, inner_iteration_tolerance=0.001, min_linear_solver_iterations=0, max_linear_solver_iterations=200, eta=0.1, jacobi_scaling=True, logging_type=LoggingType.SILENT, minimizer_progress_to_stdout=False, trust_region_problem_dump_directory=’/tmp’, trust_region_problem_dump_format_type=DumpFormatType.TEXTFILE, check_gradients=False, gradient_check_relative_precision=1e-08, gradient_check_numeric_derivative_relative_step_size=1e-06, update_state_every_iteration=False), min_num_images_gpu_solver=50, min_num_residuals_for_cpu_multi_threading=50000, max_num_images_direct_dense_cpu_solver=50, max_num_images_direct_sparse_cpu_solver=1000, max_num_images_direct_dense_gpu_solver=200, max_num_images_direct_sparse_gpu_solver=4000, auto_select_solver_type=True))

property caspar#

Caspar-specific bundle adjustment options. (CasparBundleAdjustmentOptions, default: CasparBundleAdjustmentOptions(solver_iter_max=200, pcg_iter_max=20, diag_init=1.0, diag_min=1e-12, diag_scaling_up=2.0, diag_scaling_down=0.333333, diag_exit_value=1000.0, score_exit_value=0.0, pcg_rel_error_exit=0.0001, pcg_rel_score_exit=-1.0, pcg_rel_decrease_min=-1.0, solver_rel_decrease_min=1.0, gpu_index=’-1’))

check(self: pycolmap.BundleAdjustmentOptions) bool#
summary(self: pycolmap.BundleAdjustmentOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.BundleAdjustmentOptions, recursive: bool = True) dict#
class pycolmap.CeresPosePriorBundleAdjustmentOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.CeresPosePriorBundleAdjustmentOptions) None

  2. __init__(self: pycolmap.CeresPosePriorBundleAdjustmentOptions, arg0: dict) None

  3. __init__(self: pycolmap.CeresPosePriorBundleAdjustmentOptions, **kwargs) None

property prior_position_loss_function_type#

Loss function for prior position loss. (LossFunctionType, default: LossFunctionType.TRIVIAL)

property prior_position_loss_scale#

Threshold on the residual for the robust loss (chi2 for 3DOF at 95% = 7.815). (float, default: 2.7954834829151074)

check(self: pycolmap.CeresPosePriorBundleAdjustmentOptions) bool#
summary(
self: pycolmap.CeresPosePriorBundleAdjustmentOptions,
write_type: bool = False,
) str#
mergedict(self: object, kwargs: dict) None#
todict(
self: pycolmap.CeresPosePriorBundleAdjustmentOptions,
recursive: bool = True,
) dict#
class pycolmap.PosePriorBundleAdjustmentOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.PosePriorBundleAdjustmentOptions) None

  2. __init__(self: pycolmap.PosePriorBundleAdjustmentOptions, arg0: dict) None

  3. __init__(self: pycolmap.PosePriorBundleAdjustmentOptions, **kwargs) None

property prior_position_fallback_stddev#

Fallback if no prior position covariance is provided. (float, default: 1.0)

property alignment_ransac#

RANSAC options for Sim3 alignment. (RANSACOptions, default: RANSACOptions(max_error=0.0, min_inlier_ratio=0.1, confidence=0.99, dyn_num_trials_multiplier=3.0, min_num_trials=0, max_num_trials=2147483647, random_seed=-1, num_threads=1))

property ceres#

Ceres-specific pose prior bundle adjustment options. (CeresPosePriorBundleAdjustmentOptions, default: CeresPosePriorBundleAdjustmentOptions(prior_position_loss_function_type=LossFunctionType.TRIVIAL, prior_position_loss_scale=2.7954834829151074))

check(self: pycolmap.PosePriorBundleAdjustmentOptions) bool#
summary(
self: pycolmap.PosePriorBundleAdjustmentOptions,
write_type: bool = False,
) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.PosePriorBundleAdjustmentOptions, recursive: bool = True) dict#
class pycolmap.BundleAdjuster(
self: pycolmap.BundleAdjuster,
options: pycolmap.BundleAdjustmentOptions,
config: pycolmap.BundleAdjustmentConfig,
)#
solve(self: pycolmap.BundleAdjuster) pycolmap.BundleAdjustmentSummary#
property options#
property config#
class pycolmap.CeresBundleAdjuster(
self: pycolmap.CeresBundleAdjuster,
options: pycolmap.BundleAdjustmentOptions,
config: pycolmap.BundleAdjustmentConfig,
)#
property problem#
pycolmap.create_default_bundle_adjuster(
options: pycolmap.BundleAdjustmentOptions,
config: pycolmap.BundleAdjustmentConfig,
reconstruction: pycolmap.Reconstruction,
) pycolmap.BundleAdjuster#
pycolmap.create_default_ceres_bundle_adjuster(
options: pycolmap.BundleAdjustmentOptions,
config: pycolmap.BundleAdjustmentConfig,
reconstruction: pycolmap.Reconstruction,
) pycolmap.CeresBundleAdjuster#
pycolmap.create_pose_prior_bundle_adjuster(
options: pycolmap.BundleAdjustmentOptions,
prior_options: pycolmap.PosePriorBundleAdjustmentOptions,
config: pycolmap.BundleAdjustmentConfig,
pose_priors: collections.abc.Sequence[pycolmap.PosePrior],
reconstruction: pycolmap.Reconstruction,
) pycolmap.BundleAdjuster#
pycolmap.create_pose_prior_ceres_bundle_adjuster(
options: pycolmap.BundleAdjustmentOptions,
prior_options: pycolmap.PosePriorBundleAdjustmentOptions,
config: pycolmap.BundleAdjustmentConfig,
pose_priors: collections.abc.Sequence[pycolmap.PosePrior],
reconstruction: pycolmap.Reconstruction,
) pycolmap.CeresBundleAdjuster#
class pycolmap.BACovarianceOptionsParams(*args, **kwargs)#

Members:

POSES

POINTS

POSES_AND_POINTS

ALL

Overloaded function.

  1. __init__(self: pycolmap.BACovarianceOptionsParams, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.BACovarianceOptionsParams, name: str) None

property name#
property value#
POSES = BACovarianceOptionsParams.POSES#
POINTS = BACovarianceOptionsParams.POINTS#
POSES_AND_POINTS = BACovarianceOptionsParams.POSES_AND_POINTS#
ALL = BACovarianceOptionsParams.ALL#
class pycolmap.ExperimentalPoseParam(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.ExperimentalPoseParam) None

  2. __init__(self: pycolmap.ExperimentalPoseParam, arg0: dict) None

  3. __init__(self: pycolmap.ExperimentalPoseParam, **kwargs) None

property image_id#

(int, default: 4294967295)

property cam_from_world#

(NoneType, default: None)

summary(self: pycolmap.ExperimentalPoseParam, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.ExperimentalPoseParam, recursive: bool = True) dict#
class pycolmap.BACovarianceOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.BACovarianceOptions) None

  2. __init__(self: pycolmap.BACovarianceOptions, arg0: dict) None

  3. __init__(self: pycolmap.BACovarianceOptions, **kwargs) None

property params#

For which parameters to compute the covariance. (BACovarianceOptionsParams, default: BACovarianceOptionsParams.ALL)

property damping#

Damping factor for the Hessian in the Schur complement solver. Enables to robustly deal with poorly conditioned parameters. (float, default: 1e-08)

property experimental_custom_poses#

WARNING: This option will be removed in a future release, use at your own risk. For custom bundle adjustment problems, this enables to specify a custom set of pose parameter blocks to consider. Note that these pose blocks must not necessarily be part of the reconstruction but they must follow the standard requirement for applying the Schur complement trick. (list, default: [])

summary(self: pycolmap.BACovarianceOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.BACovarianceOptions, recursive: bool = True) dict#
class pycolmap.BACovariance#
get_point_cov(
self: pycolmap.BACovariance,
point3D_id: SupportsInt | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]'] | None#

Covariance for 3D points, conditioned on all other variables set constant. If some dimensions are kept constant, the respective rows/columns are omitted. Returns null if 3D point not a variable in the problem.

get_cam_cov_from_world(
self: pycolmap.BACovariance,
image_id: SupportsInt | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]'] | None#

Tangent space covariance in the order [rotation, translation]. If some dimensions are kept constant, the respective rows/columns are omitted. Returns null if image is not a variable in the problem.

get_cam_cross_cov_from_world(
self: pycolmap.BACovariance,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]'] | None#

Tangent space covariance in the order [rotation, translation]. If some dimensions are kept constant, the respective rows/columns are omitted. Returns null if image is not a variable in the problem.

get_cam2_cov_from_cam1(
self: pycolmap.BACovariance,
image_id1: SupportsInt | SupportsIndex,
cam1_from_world: pycolmap.Rigid3d,
image_id2: SupportsInt | SupportsIndex,
cam2_from_world: pycolmap.Rigid3d,
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]'] | None#

Get relative pose covariance in the order [rotation, translation]. This function returns null if some dimensions are kept constant for either of the two poses. This does not mean that one cannot get relative pose covariance for such case, but requires custom logic to fill in zero block in the covariance matrix.

get_other_params_cov(
self: pycolmap.BACovariance,
param: Annotated[numpy.typing.ArrayLike, numpy.float64],
) Annotated[numpy.typing.NDArray[numpy.float64], '[m, n]'] | None#

Tangent space covariance for any variable parameter block in the problem. If some dimensions are kept constant, the respective rows/columns are omitted. Returns null if parameter block not a variable in the problem.

pycolmap.estimate_ba_covariance(
options: pycolmap.BACovarianceOptions,
reconstruction: pycolmap.Reconstruction,
bundle_adjuster: pycolmap.CeresBundleAdjuster,
) pycolmap.BACovariance | None#

Computes covariances for the parameters in a bundle adjustment problem. It is important that the problem has a structure suitable for solving using the Schur complement trick. This is the case for the standard configuration of bundle adjustment problems, but be careful if you modify the underlying problem with custom residuals. Returns null if the estimation was not successful.

pycolmap.estimate_ba_covariance_from_problem(
options: pycolmap.BACovarianceOptions,
reconstruction: pycolmap.Reconstruction,
problem: ceres::Problem,
) pycolmap.BACovariance | None#

Computes covariances for the parameters in a bundle adjustment problem. It is important that the problem has a structure suitable for solving using the Schur complement trick. This is the case for the standard configuration of bundle adjustment problems, but be careful if you modify the underlying problem with custom residuals. Returns null if the estimation was not successful.

pycolmap.estimate_essential_matrix(
points2D1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points2D2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
camera1: pycolmap.Camera,
camera2: pycolmap.Camera,
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None#

Robustly estimate essential matrix with LO-RANSAC and decompose it using the cheirality check.

pycolmap.estimate_fundamental_matrix(
points2D1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points2D2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None#

Robustly estimate fundamental matrix with LO-RANSAC.

pycolmap.estimate_generalized_absolute_pose(
points2D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
camera_idxs: collections.abc.Sequence[SupportsInt | SupportsIndex],
cams_from_rig: collections.abc.Sequence[pycolmap.Rigid3d],
cameras: collections.abc.Sequence[pycolmap.Camera],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None#
pycolmap.refine_generalized_absolute_pose(
rig_from_world: pycolmap.Rigid3d,
points2D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
inlier_mask: Annotated[numpy.typing.ArrayLike, numpy.bool, '[m, 1]'],
camera_idxs: collections.abc.Sequence[SupportsInt | SupportsIndex],
cams_from_rig: collections.abc.Sequence[pycolmap.Rigid3d],
cameras: collections.abc.Sequence[pycolmap.Camera],
refinement_options: pycolmap.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(),
return_covariance: bool = False,
) dict | None#

Robustly estimate generalized absolute pose using LO-RANSACfollowed by non-linear refinement.

pycolmap.estimate_and_refine_generalized_absolute_pose(
points2D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points3D: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
camera_idxs: collections.abc.Sequence[SupportsInt | SupportsIndex],
cams_from_rig: collections.abc.Sequence[pycolmap.Rigid3d],
cameras: collections.abc.Sequence[pycolmap.Camera],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
refinement_options: pycolmap.AbsolutePoseRefinementOptions = AbsolutePoseRefinementOptions(),
return_covariance: bool = False,
) dict | None#

Robustly estimate generalized absolute pose using LO-RANSACfollowed by non-linear refinement.

pycolmap.estimate_generalized_relative_pose(
points2D1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points2D2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
camera_idxs1: collections.abc.Sequence[SupportsInt | SupportsIndex],
camera_idxs2: collections.abc.Sequence[SupportsInt | SupportsIndex],
cams_from_rig: collections.abc.Sequence[pycolmap.Rigid3d],
cameras: collections.abc.Sequence[pycolmap.Camera],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None#
pycolmap.estimate_homography_matrix(
points2D1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points2D2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) dict | None#

Robustly estimate homography matrix using LO-RANSAC.

pycolmap.estimate_rigid3d(
src: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
tgt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
) pycolmap.Rigid3d | None#

Estimate the 3D rigid transform tgt_from_src.

pycolmap.estimate_rigid3d_robust(
src: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
tgt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) pycolmap.Rigid3d | None#

Robustly estimate the 3D rigid transform tgt_from_src using LO-RANSAC.

pycolmap.estimate_sim3d(
src: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
tgt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
) pycolmap.Sim3d | None#

Estimate the 3D similarity transform tgt_from_src.

pycolmap.estimate_sim3d_robust(
src: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
tgt: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 3]'],
estimation_options: pycolmap.RANSACOptions = RANSACOptions(),
) pycolmap.Sim3d | None#

Robustly estimate the 3D similarity transform tgt_from_src using LO-RANSAC.

class pycolmap.TriangulationResidualType(*args, **kwargs)#

Members:

ANGULAR_ERROR

REPROJECTION_ERROR

Overloaded function.

  1. __init__(self: pycolmap.TriangulationResidualType, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.TriangulationResidualType, name: str) None

property name#
property value#
ANGULAR_ERROR = TriangulationResidualType.ANGULAR_ERROR#
REPROJECTION_ERROR = TriangulationResidualType.REPROJECTION_ERROR#
class pycolmap.EstimateTriangulationOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.EstimateTriangulationOptions) None

  2. __init__(self: pycolmap.EstimateTriangulationOptions, arg0: dict) None

  3. __init__(self: pycolmap.EstimateTriangulationOptions, **kwargs) None

property min_tri_angle#

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

property residual_type#

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

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, random_seed=-1, num_threads=1))

summary(self: pycolmap.EstimateTriangulationOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.EstimateTriangulationOptions, recursive: bool = True) dict#
pycolmap.estimate_triangulation(
points: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
cams_from_world: collections.abc.Sequence[pycolmap.Rigid3d],
cameras: collections.abc.Sequence[pycolmap.Camera],
options: pycolmap.EstimateTriangulationOptions = EstimateTriangulationOptions(),
) dict | None#

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

class pycolmap.TwoViewGeometryOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.TwoViewGeometryOptions) None

  2. __init__(self: pycolmap.TwoViewGeometryOptions, arg0: dict) None

  3. __init__(self: pycolmap.TwoViewGeometryOptions, **kwargs) None

property min_num_inliers#

(int, default: 15)

property min_inlier_ratio#

(float, default: 0.0)

property min_E_F_inlier_ratio#

(float, default: 0.95)

property max_H_inlier_ratio#

(float, default: 0.8)

property watermark_min_inlier_ratio#

(float, default: 0.7)

property watermark_border_size#

(float, default: 0.1)

property detect_watermark#

(bool, default: True)

property multiple_ignore_watermark#

(bool, default: True)

property watermark_detection_max_error#

(float, default: 4.0)

property filter_stationary_matches#

(bool, default: False)

property stationary_matches_max_error#

(float, default: 4.0)

property force_H_use#

(bool, default: False)

property compute_relative_pose#

(bool, default: False)

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, random_seed=-1, num_threads=1))

summary(self: pycolmap.TwoViewGeometryOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.TwoViewGeometryOptions, recursive: bool = True) dict#
pycolmap.estimate_calibrated_two_view_geometry(
camera1: pycolmap.Camera,
points1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
camera2: pycolmap.Camera,
points2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
matches: Annotated[numpy.typing.ArrayLike, numpy.uint32, '[m, 2]'] = None,
options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
) pycolmap.TwoViewGeometry#
pycolmap.estimate_two_view_geometry(
camera1: pycolmap.Camera,
points1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
camera2: pycolmap.Camera,
points2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
matches: Annotated[numpy.typing.ArrayLike, numpy.uint32, '[m, 2]'] = None,
options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
) pycolmap.TwoViewGeometry#
pycolmap.estimate_two_view_geometry_pose(
camera1: pycolmap.Camera,
points1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
camera2: pycolmap.Camera,
points2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
geometry: pycolmap.TwoViewGeometry,
) bool#
pycolmap.compute_squared_sampson_error(
points2D1: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
points2D2: Annotated[numpy.typing.ArrayLike, numpy.float64, '[m, 2]'],
E: Annotated[numpy.typing.ArrayLike, numpy.float64, '[3, 3]'],
) list[float]#

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

class pycolmap.GravityRefinerOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.GravityRefinerOptions) None

  2. __init__(self: pycolmap.GravityRefinerOptions, arg0: dict) None

  3. __init__(self: pycolmap.GravityRefinerOptions, **kwargs) None

property max_outlier_ratio#

Maximum ratio that gravity should be consistent with. (float, default: 0.5)

property max_gravity_error#

Maximum allowed angle error in degrees. (float, default: 1.0)

property min_num_neighbors#

Minimum neighbors required for refinement. (int, default: 7)

summary(self: pycolmap.GravityRefinerOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.GravityRefinerOptions, recursive: bool = True) dict#
pycolmap.run_gravity_refinement(
options: pycolmap.GravityRefinerOptions,
pose_graph: pycolmap.PoseGraph,
reconstruction: pycolmap.Reconstruction,
pose_priors: collections.abc.Sequence[pycolmap.PosePrior],
) None#

Refine gravity stored in pose priors using relative rotations from the pose graph. Modifies pose_priors in-place.

class pycolmap.RotationWeightType(*args, **kwargs)#

Members:

GEMAN_MCCLURE

HALF_NORM

Overloaded function.

  1. __init__(self: pycolmap.RotationWeightType, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.RotationWeightType, name: str) None

property name#
property value#
GEMAN_MCCLURE = RotationWeightType.GEMAN_MCCLURE#
HALF_NORM = RotationWeightType.HALF_NORM#
class pycolmap.RotationAveragingReweighting(*args, **kwargs)#

Members:

UNIFORM

INLIER_MATCH_COUNT

Overloaded function.

  1. __init__(self: pycolmap.RotationAveragingReweighting, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.RotationAveragingReweighting, name: str) None

property name#
property value#
UNIFORM = RotationAveragingReweighting.UNIFORM#
INLIER_MATCH_COUNT = RotationAveragingReweighting.INLIER_MATCH_COUNT#
class pycolmap.RotationEstimatorOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.RotationEstimatorOptions) None

  2. __init__(self: pycolmap.RotationEstimatorOptions, arg0: dict) None

  3. __init__(self: pycolmap.RotationEstimatorOptions, **kwargs) None

property random_seed#

PRNG seed. -1 for non-deterministic, >=0 for deterministic. (int, default: -1)

property max_num_l1_iterations#

Maximum number of L1 minimization iterations. (int, default: 5)

property l1_step_convergence_threshold#

Average step size threshold to terminate L1 minimization. (float, default: 0.001)

property max_num_irls_iterations#

Number of IRLS iterations to perform. (int, default: 100)

property irls_step_convergence_threshold#

Average step size threshold to terminate IRLS. (float, default: 0.001)

property gravity_dir#

Gravity direction vector. (ndarray, default: [0. 1. 0.])

property irls_loss_parameter_sigma#

Point where Huber-like cost switches from L1 to L2 (degrees). (float, default: 5.0)

property ridge_regularization#

Tikhonov ridge added to the diagonal of the normal equations before each Cholesky factorization in the L1 and IRLS phases. Set to a small positive value (e.g., 1e-9) to stabilize poorly conditioned systems. Zero disables regularization. (float, default: 1e-09)

property weight_type#

Weight type for IRLS: GEMAN_MCCLURE or HALF_NORM. (RotationWeightType, default: RotationWeightType.GEMAN_MCCLURE)

property skip_initialization#

Skip maximum spanning tree initialization. (bool, default: False)

property use_gravity#

Use gravity priors for rotation averaging. (bool, default: False)

property use_stratified#

Use stratified solving for mixed gravity systems. (bool, default: True)

property filter_unregistered#

Only consider frames with existing poses for connected components. (bool, default: False)

property max_rotation_error_deg#

Filter pairs with rotation error exceeding this threshold (degrees). (float, default: 10.0)

property refine_sensor_from_rig#

When False, treat each non-ref sensor’s cam_from_rig as a pre-calibrated constant. (bool, default: True)

property reweighting#

Reweighting scheme for relative-rotation constraints: UNIFORM or INLIER_MATCH_COUNT. (RotationAveragingReweighting, default: RotationAveragingReweighting.UNIFORM)

summary(self: pycolmap.RotationEstimatorOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.RotationEstimatorOptions, recursive: bool = True) dict#
pycolmap.run_rotation_averaging(
options: pycolmap.RotationEstimatorOptions,
pose_graph: pycolmap.PoseGraph,
reconstruction: pycolmap.Reconstruction,
pose_priors: collections.abc.Sequence[pycolmap.PosePrior],
) bool#

High-level rotation averaging solver that handles rig expansion. Returns True if rotation averaging succeeded.

class pycolmap.GlobalPositionerOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.GlobalPositionerOptions) None

  2. __init__(self: pycolmap.GlobalPositionerOptions, arg0: dict) None

  3. __init__(self: pycolmap.GlobalPositionerOptions, **kwargs) None

property generate_random_positions#

Whether to initialize camera positions randomly. (bool, default: True)

property generate_random_points#

Whether to initialize 3D point positions randomly. (bool, default: True)

property generate_scales#

Whether to initialize scales to constant 1 or derive from positions. (bool, default: True)

property optimize_positions#

Whether to optimize camera positions. (bool, default: True)

property optimize_points#

Whether to optimize 3D point positions. (bool, default: True)

property optimize_scales#

Whether to optimize scales. (bool, default: True)

property refine_sensor_from_rig#

When False, treat sensor_from_rig as a fixed pre-calibrated parameter. (bool, default: True)

property use_gpu#

Whether to use GPU for optimization. (bool, default: True)

property gpu_index#

GPU device index (-1 for auto). (str, default: -1)

property min_num_images_gpu_solver#

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

property min_num_view_per_track#

Minimum number of views per track. (int, default: 3)

property random_seed#

PRNG seed for random initialization. -1 for non-deterministic. (int, default: -1)

property loss_function_scale#

Scaling factor for the loss function. (float, default: 0.1)

property use_parameter_block_ordering#

Whether to use custom parameter block ordering. (bool, default: True)

summary(self: pycolmap.GlobalPositionerOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.GlobalPositionerOptions, recursive: bool = True) dict#
pycolmap.run_global_positioning(
options: pycolmap.GlobalPositionerOptions,
pose_graph: pycolmap.PoseGraph,
reconstruction: pycolmap.Reconstruction,
) bool#

Solve global positioning using point-to-camera constraints. Returns True if optimization succeeded.

class pycolmap.ImageScore(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.ImageScore) None

  2. __init__(self: pycolmap.ImageScore, arg0: dict) None

  3. __init__(self: pycolmap.ImageScore, **kwargs) None

property image_id#

(int, default: -1)

property score#

(float, default: 0.0)

summary(self: pycolmap.ImageScore, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.ImageScore, recursive: bool = True) dict#
class pycolmap.VisualIndex(self: pycolmap.VisualIndex)#
class IndexOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.VisualIndex.IndexOptions) None

  2. __init__(self: pycolmap.VisualIndex.IndexOptions, arg0: dict) None

  3. __init__(self: pycolmap.VisualIndex.IndexOptions, **kwargs) None

mergedict(self: object, kwargs: dict) None#
property num_checks#

(int, default: 64)

property num_neighbors#

(int, default: 1)

property num_threads#

(int, default: -1)

summary(self: pycolmap.VisualIndex.IndexOptions, write_type: bool = False) str#
todict(self: pycolmap.VisualIndex.IndexOptions, recursive: bool = True) dict#
class QueryOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.VisualIndex.QueryOptions) None

  2. __init__(self: pycolmap.VisualIndex.QueryOptions, arg0: dict) None

  3. __init__(self: pycolmap.VisualIndex.QueryOptions, **kwargs) None

property max_num_images#

(int, default: -1)

mergedict(self: object, kwargs: dict) None#
property num_checks#

(int, default: 64)

property num_images_after_verification#

(int, default: 0)

property num_neighbors#

(int, default: 5)

property num_threads#

(int, default: -1)

summary(self: pycolmap.VisualIndex.QueryOptions, write_type: bool = False) str#
todict(self: pycolmap.VisualIndex.QueryOptions, recursive: bool = True) dict#
class BuildOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.VisualIndex.BuildOptions) None

  2. __init__(self: pycolmap.VisualIndex.BuildOptions, arg0: dict) None

  3. __init__(self: pycolmap.VisualIndex.BuildOptions, **kwargs) None

mergedict(self: object, kwargs: dict) None#
property num_checks#

(int, default: 256)

property num_iterations#

(int, default: 100)

property num_rounds#

(int, default: 3)

property num_threads#

(int, default: -1)

property num_visual_words#

(int, default: 65536)

summary(self: pycolmap.VisualIndex.BuildOptions, write_type: bool = False) str#
todict(self: pycolmap.VisualIndex.BuildOptions, recursive: bool = True) dict#
static create(
arg0: SupportsInt | SupportsIndex,
arg1: SupportsInt | SupportsIndex,
) pycolmap.VisualIndex#
add(
self: pycolmap.VisualIndex,
arg0: pycolmap.VisualIndex.IndexOptions,
arg1: SupportsInt | SupportsIndex,
arg2: pycolmap.FeatureKeypoints,
arg3: pycolmap.FeatureDescriptorsFloat,
) None#
is_image_indexed(self: pycolmap.VisualIndex, arg0: SupportsInt | SupportsIndex) bool#
num_visual_words(self: pycolmap.VisualIndex) int#
num_images(self: pycolmap.VisualIndex) int#
desc_dim(self: pycolmap.VisualIndex) int#
embedding_dim(self: pycolmap.VisualIndex) int#
feature_type(self: pycolmap.VisualIndex) pycolmap.FeatureExtractorType#
query(*args, **kwargs)#

Overloaded function.

  1. query(self: pycolmap.VisualIndex, arg0: pycolmap.VisualIndex.QueryOptions, arg1: pycolmap.FeatureDescriptorsFloat, arg2: collections.abc.Sequence[pycolmap.ImageScore]) None

  2. query(self: pycolmap.VisualIndex, arg0: pycolmap.VisualIndex.QueryOptions, arg1: pycolmap.FeatureKeypoints, arg2: pycolmap.FeatureDescriptorsFloat, arg3: collections.abc.Sequence[pycolmap.ImageScore]) None

prepare(self: pycolmap.VisualIndex) None#
build(
self: pycolmap.VisualIndex,
arg0: pycolmap.VisualIndex.BuildOptions,
arg1: pycolmap.FeatureDescriptorsFloat,
) None#
static read(arg0: os.PathLike | str | bytes) pycolmap.VisualIndex#
write(self: pycolmap.VisualIndex, arg0: os.PathLike | str | bytes) None#
class pycolmap.ImagePairStat(self: pycolmap.ImagePairStat)#
property num_tri_corrs#
property num_total_corrs#
class pycolmap.ReprojectionErrorType(*args, **kwargs)#

Members:

PIXEL

NORMALIZED

ANGULAR

Overloaded function.

  1. __init__(self: pycolmap.ReprojectionErrorType, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.ReprojectionErrorType, name: str) None

property name#
property value#
PIXEL = ReprojectionErrorType.PIXEL#
NORMALIZED = ReprojectionErrorType.NORMALIZED#
ANGULAR = ReprojectionErrorType.ANGULAR#
class pycolmap.ObservationManager(
self: pycolmap.ObservationManager,
reconstruction: pycolmap.Reconstruction,
correspondence_graph: pycolmap.CorrespondenceGraph = None,
)#
property image_pairs#
add_image(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
) None#

Incrementally add an image for streaming/online SfM.

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

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

add_observation(
self: pycolmap.ObservationManager,
point3D_id: SupportsInt | SupportsIndex,
track_element: pycolmap.TrackElement,
) None#

Add observation to existing 3D point.

delete_point3D(
self: pycolmap.ObservationManager,
point3D_id: SupportsInt | SupportsIndex,
) None#

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

delete_observation(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) 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.

merge_points3D(
self: pycolmap.ObservationManager,
point3D_id1: SupportsInt | SupportsIndex,
point3D_id2: SupportsInt | SupportsIndex,
) 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.

filter_points3D(
self: pycolmap.ObservationManager,
max_reproj_error: SupportsFloat | SupportsIndex,
min_tri_angle: SupportsFloat | SupportsIndex,
point3D_ids: collections.abc.Set[SupportsInt | SupportsIndex],
) 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: SupportsFloat | SupportsIndex,
min_tri_angle: SupportsFloat | SupportsIndex,
image_ids: collections.abc.Set[SupportsInt | SupportsIndex],
) int#

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

filter_all_points3D(
self: pycolmap.ObservationManager,
max_reproj_error: SupportsFloat | SupportsIndex,
min_tri_angle: SupportsFloat | SupportsIndex,
) int#

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

filter_points3D_with_short_tracks(
self: pycolmap.ObservationManager,
min_track_length: SupportsInt | SupportsIndex,
) int#

Filter points with track length below threshold. Return the number of filtered observations.

filter_observations_with_negative_depth(self: pycolmap.ObservationManager) int#

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

filter_points3D_with_large_reprojection_error(
self: pycolmap.ObservationManager,
max_error: SupportsFloat | SupportsIndex,
point3D_ids: collections.abc.Set[SupportsInt | SupportsIndex],
error_type: pycolmap.ReprojectionErrorType = ReprojectionErrorType.PIXEL,
) int#

Filter observations with large reprojection error. For PIXEL and NORMALIZED, max_error is the reprojection error; for ANGULAR, it is the angular error in degrees. Return the number of filtered observations.

filter_points3D_with_small_triangulation_angle(
self: pycolmap.ObservationManager,
min_tri_angle: SupportsFloat | SupportsIndex,
point3D_ids: collections.abc.Set[SupportsInt | SupportsIndex],
) int#

Filter 3D points with insufficient triangulation angle in degrees. Return the number of filtered observations.

filter_frames(
self: pycolmap.ObservationManager,
min_focal_length_ratio: SupportsFloat | SupportsIndex,
max_focal_length_ratio: SupportsFloat | SupportsIndex,
max_extra_param: SupportsFloat | SupportsIndex,
min_num_observations: SupportsInt | SupportsIndex,
) list[int]#

Find frames that should be filtered due to having no observations or bogus camera parameters, without de-registering them. Pass them to DeRegisterFrame to reset their pose.Return the identifiers of the frames to filter.

register_frame(
self: pycolmap.ObservationManager,
frame_id: SupportsInt | SupportsIndex,
) None#

Register an existing frame, and all its references..

deregister_frame(
self: pycolmap.ObservationManager,
frame_id: SupportsInt | SupportsIndex,
) None#

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

num_observations(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
) int#

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

num_correspondences(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
) int#

Number of correspondences for all image points.

num_visible_correspondences(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
) int#

Number of visible correspondences for all image points.

num_visible_points3D(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
) 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: SupportsInt | SupportsIndex,
) 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.

increment_correspondence_has_point3D(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) None#

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

decrement_correspondence_has_point3D(
self: pycolmap.ObservationManager,
image_id: SupportsInt | SupportsIndex,
point2D_idx: SupportsInt | SupportsIndex,
) 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.

class pycolmap.IncrementalTriangulatorOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.IncrementalTriangulatorOptions) None

  2. __init__(self: pycolmap.IncrementalTriangulatorOptions, arg0: dict) None

  3. __init__(self: pycolmap.IncrementalTriangulatorOptions, **kwargs) None

property max_transitivity#

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

property create_max_angle_error#

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

property continue_max_angle_error#

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

property merge_max_reproj_error#

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

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 re_max_angle_error#

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

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)

property re_max_trials#

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

property min_angle#

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

property ignore_two_view_tracks#

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

property min_focal_length_ratio#

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

property max_focal_length_ratio#

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

property max_extra_param#

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

property random_seed#

PRNG seed for all stochastic methods during triangulation. (int, default: -1)

check(self: pycolmap.IncrementalTriangulatorOptions) bool#
summary(self: pycolmap.IncrementalTriangulatorOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.IncrementalTriangulatorOptions, recursive: bool = True) dict#
class pycolmap.IncrementalTriangulator(
self: pycolmap.IncrementalTriangulator,
correspondence_graph: pycolmap.CorrespondenceGraph,
reconstruction: pycolmap.Reconstruction,
observation_manager: pycolmap.ObservationManager = None,
)#

Class that triangulates points during the incremental reconstruction. It holds the state and provides all functionality for triangulation.

Create new incremental triangulator. Note that both the correspondence graph and the reconstruction objects must live as long as the triangulator.

triangulate_image(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
image_id: SupportsInt | SupportsIndex,
) int#

Triangulate observations of image. Triangulation includes creation of new points, continuation of existing points, and merging of separate points if given image bridges tracks. Note that the given image must be registered and its pose must be set in the associated reconstruction.

complete_image(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
image_id: SupportsInt | SupportsIndex,
) int#

Complete triangulations for image. Tries to create new tracks for not yet triangulated observations and tries to complete existing tracks. Returns the number of completed observations.

complete_all_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
) int#

Complete tracks of all 3D points. Returns the number of completed observations.

merge_all_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
) int#

Merge tracks of all 3D points. Returns the number of merged observations.

retriangulate(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
) int#

Perform retriangulation for under-reconstructed image pairs. Under-reconstruction usually occurs in the case of a drifting reconstruction.

add_modified_point3D(
self: pycolmap.IncrementalTriangulator,
point3D_id: SupportsInt | SupportsIndex,
) None#

Indicate that a 3D point has been modified.

clear_modified_points3D(self: pycolmap.IncrementalTriangulator) None#

Clear the collection of changed 3D points.

get_modified_points3D(self: pycolmap.IncrementalTriangulator) set[int]#

Get changed 3D points, since the last call to clear_modified_points3D.

merge_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
point3D_ids: collections.abc.Set[SupportsInt | SupportsIndex],
) int#

Merge tracks for specific 3D points. Returns the number of merged observations.

complete_tracks(
self: pycolmap.IncrementalTriangulator,
options: pycolmap.IncrementalTriangulatorOptions,
point3D_ids: collections.abc.Set[SupportsInt | SupportsIndex],
) int#

Complete tracks for specific 3D points. Completion tries to recursively add observations to a track that might have failed to triangulate before due to inaccurate poses, etc. Returns the number of completed observations.

class pycolmap.ImageSelectionMethod(*args, **kwargs)#

Members:

MAX_VISIBLE_POINTS_NUM

MAX_VISIBLE_POINTS_RATIO

MIN_UNCERTAINTY

Overloaded function.

  1. __init__(self: pycolmap.ImageSelectionMethod, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.ImageSelectionMethod, name: str) None

property name#
property value#
MAX_VISIBLE_POINTS_NUM = ImageSelectionMethod.MAX_VISIBLE_POINTS_NUM#
MAX_VISIBLE_POINTS_RATIO = ImageSelectionMethod.MAX_VISIBLE_POINTS_RATIO#
MIN_UNCERTAINTY = ImageSelectionMethod.MIN_UNCERTAINTY#
class pycolmap.IncrementalMapperOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.IncrementalMapperOptions) None

  2. __init__(self: pycolmap.IncrementalMapperOptions, arg0: dict) None

  3. __init__(self: pycolmap.IncrementalMapperOptions, **kwargs) None

property init_min_num_inliers#

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

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_min_tri_angle#

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

property init_max_reg_trials#

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

property abs_pose_max_error#

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

property abs_pose_min_num_inliers#

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

property abs_pose_min_inlier_ratio#

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

property abs_pose_refine_focal_length#

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

property abs_pose_refine_extra_params#

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

property ba_local_num_images#

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

property ba_local_min_tri_angle#

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

property ba_global_ignore_redundant_points3D#

Whether to ignore redundant 3D points in bundle adjustment when jointly optimizing all parameters. If this is enabled, then the bundle adjustment problem is first solved with a reduced set of 3D points and then the remaining 3D points are optimized in a second step with all other parameters fixed. Points excplicitly configured as constant or variable are not ignored. This is only activated when the reconstruction has reached sufficient size with at least 10 registered frames. (bool, default: False)

property ba_global_prune_points_min_coverage_gain#

The minimum coverage gain for any 3D point to be included in the optimization. A larger value means more 3D points are ignored. (float, default: 0.05)

property min_focal_length_ratio#

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

property max_focal_length_ratio#

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

property max_extra_param#

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

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 max_reg_trials#

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

property fix_existing_frames#

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

property constant_rigs#

List of rigs for which to fix the sensor_from_rig transformation, independent of ba_refine_sensor_from_rig. (set, default: set())

property constant_cameras#

List of cameras for which to fix the camera parameters independent of refine_focal_length, refine_principal_point, and refine_extra_params. (set, default: set())

property num_threads#

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

property random_seed#

PRNG seed for all stochastic methods during reconstruction. (int, default: -1)

property image_selection_method#

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

check(self: pycolmap.IncrementalMapperOptions) bool#
summary(self: pycolmap.IncrementalMapperOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.IncrementalMapperOptions, recursive: bool = True) dict#
class pycolmap.LocalBundleAdjustmentReport(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.LocalBundleAdjustmentReport) None

  2. __init__(self: pycolmap.LocalBundleAdjustmentReport, arg0: dict) None

  3. __init__(self: pycolmap.LocalBundleAdjustmentReport, **kwargs) None

property num_merged_observations#

(int, default: 0)

property num_completed_observations#

(int, default: 0)

property num_filtered_observations#

(int, default: 0)

property num_adjusted_observations#

(int, default: 0)

summary(self: pycolmap.LocalBundleAdjustmentReport, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.LocalBundleAdjustmentReport, recursive: bool = True) dict#
class pycolmap.IncrementalMapper(self: pycolmap.IncrementalMapper, database_cache: pycolmap.DatabaseCache)#

Class that provides all functionality for the incremental reconstruction procedure.

Create incremental mapper. The database cache must live for the entire life-time of the incremental mapper.

begin_reconstruction(
self: pycolmap.IncrementalMapper,
reconstruction: pycolmap.Reconstruction,
) None#

Prepare the mapper for a new reconstruction, which might have existing registered images (in which case register_next_image must be called) or which is empty (in which case register_initial_image_pair must be called).

end_reconstruction(self: pycolmap.IncrementalMapper, discard: bool) None#

Cleanup the mapper after the current reconstruction is done. If the model is discarded, the number of total and shared registered images will be updated accordingly.

find_initial_image_pair(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) tuple[tuple[int, int], pycolmap.Rigid3d] | None#

Find initial image pair to seed the incremental reconstruction. Returns a tuple of ((image_id1, image_id2), cam2_from_cam1) on success, or None on failure. This function automatically ignores image pairs that failed to register previously.

estimate_initial_two_view_geometry(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id1: SupportsInt | SupportsIndex,
image_id2: SupportsInt | SupportsIndex,
) pycolmap.Rigid3d | None#

Estimate two-view geometry and check if it is suitable for initialization. Returns the relative pose on success, or None on failure.

register_initial_image_pair(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
two_view_geometry: SupportsInt | SupportsIndex,
image_id1: SupportsInt | SupportsIndex,
image_id2: pycolmap.Rigid3d,
) None#

Attempt to seed the reconstruction from an image pair.

find_next_images(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
structure_less: bool,
) list[int]#

Find best next images to register in the incremental reconstruction. This function automatically ignores images that failed to register for max_reg_trials.

register_next_image(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id: SupportsInt | SupportsIndex,
) bool#

Attempt to register image to the existing model. This requires that a previous call to register_initial_image_pair was successful.

register_next_structure_less_image(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id: SupportsInt | SupportsIndex,
) bool#

Attempt to register image using structure-less resectioning.

triangulate_image(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
image_id: SupportsInt | SupportsIndex,
) int#

Triangulate observations of image.

retriangulate(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int#

Retriangulate image pairs that should have common observations according to the scene graph but don’t due to drift, etc.

complete_tracks(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int#

Complete tracks by transitively following the scene graph correspondences. This is especially effective after bundle adjustment, since many cameras and point locations might have improved.

merge_tracks(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int#

Merge tracks by using scene graph correspondences. Similar to complete_tracks, this is effective after bundle adjustment and improves the redundancy in subsequent bundle adjustments.

complete_and_merge_tracks(
self: pycolmap.IncrementalMapper,
tri_options: pycolmap.IncrementalTriangulatorOptions,
) int#

Globally complete and merge tracks.

adjust_local_bundle(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
tri_options: pycolmap.IncrementalTriangulatorOptions,
image_id: SupportsInt | SupportsIndex,
point3D_ids: collections.abc.Set[SupportsInt | SupportsIndex],
) pycolmap.LocalBundleAdjustmentReport#

Adjust locally connected images and points of a reference image. In addition, refine the provided 3D points. Only images connected to the reference image are optimized. If the provided 3D points are not locally connected to the reference image, their observing images are set as constant in the adjustment.

iterative_local_refinement(
self: pycolmap.IncrementalMapper,
max_num_refinements: SupportsInt | SupportsIndex,
max_refinement_change: SupportsFloat | SupportsIndex,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
tri_options: pycolmap.IncrementalTriangulatorOptions,
image_id: SupportsInt | SupportsIndex,
) None#

Perform multiple rounds of local bundle adjustment.

find_local_bundle(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
image_id: SupportsInt | SupportsIndex,
) list[int]#

Find local bundle for given image in the reconstruction. The local bundle is defined as the images that are most connected, i.e. maximum number of shared 3D points, to the given image.

adjust_global_bundle(
self: pycolmap.IncrementalMapper,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
) bool#

Global bundle adjustment using Ceres Solver.

iterative_global_refinement(
self: pycolmap.IncrementalMapper,
max_num_refinements: SupportsInt | SupportsIndex,
max_refinement_change: SupportsFloat | SupportsIndex,
options: pycolmap.IncrementalMapperOptions,
ba_options: pycolmap.BundleAdjustmentOptions,
tri_options: pycolmap.IncrementalTriangulatorOptions,
normalize_reconstruction: bool = True,
) None#

Perform multiple rounds of global bundle adjustment.

filter_frames(self: pycolmap.IncrementalMapper, options: pycolmap.IncrementalMapperOptions) int#

Filter frames with degenerate camera parameters or no observations.

filter_points(self: pycolmap.IncrementalMapper, options: pycolmap.IncrementalMapperOptions) int#

Filter points with large reprojection errors or small triangulation angles.

property reconstruction#
property observation_manager#
property triangulator#
property filtered_frames#
property existing_frame_ids#
reset_initialization_stats(self: pycolmap.IncrementalMapper) None#

Reset registration statistics for initialization. This can be used when relaxing the initialization thresholds, such that previously tried pairs will be tried again.

property num_reg_frames_per_rig#
property num_reg_images_per_camera#
num_total_reg_images(self: pycolmap.IncrementalMapper) int#

Number of images that are registered in at least one reconstruction.

num_shared_reg_images(self: pycolmap.IncrementalMapper) int#

Number of shared images between current reconstruction and all other previous reconstructions.

get_modified_points3D(self: pycolmap.IncrementalMapper) set[int]#

Get changed 3D points, since the last call to clear_modified_points3D.

clear_modified_points3D(self: pycolmap.IncrementalMapper) None#

Clear the collection of changed 3D points.

class pycolmap.IncrementalPipelineOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.IncrementalPipelineOptions) None

  2. __init__(self: pycolmap.IncrementalPipelineOptions, arg0: dict) None

  3. __init__(self: pycolmap.IncrementalPipelineOptions, **kwargs) None

property min_num_matches#

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

property ignore_watermarks#

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

property multiple_models#

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

property max_num_models#

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

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 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. If the model contains at least half of the total number of images, we also always keep it. (int, default: 10)

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)

property structure_less_registration_fallback#

Enable fallback to structure-less image registration using 2D-2D correspondences, if structured-based registration fails using 2D-3D correspondences. (bool, default: True)

property structure_less_registration_only#

Only use structure-less and skip structure-based image registration. (bool, default: False)

property extract_colors#

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

property num_threads#

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

property random_seed#

PRNG seed for all stochastic methods during reconstruction. (int, default: -1)

property min_focal_length_ratio#

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

property max_focal_length_ratio#

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

property max_extra_param#

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

property ba_refine_focal_length#

Whether to refine the focal length during the reconstruction. (bool, default: True)

property ba_refine_principal_point#

Whether to refine the principal point during the reconstruction. (bool, default: False)

property ba_refine_extra_params#

Whether to refine extra parameters during the reconstruction. (bool, default: True)

property ba_refine_sensor_from_rig#

Whether to refine rig poses during the reconstruction. (bool, default: True)

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_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_global_frames_ratio#

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

property ba_global_points_ratio#

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

property ba_global_frames_freq#

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

property ba_global_points_freq#

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

property ba_global_function_tolerance#

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

property ba_global_max_num_iterations#

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

property ba_local_max_refinements#

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

property ba_local_max_refinement_change#

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

property ba_global_max_refinements#

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

property ba_global_max_refinement_change#

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

property ba_use_gpu#

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

property ba_gpu_index#

Index of CUDA GPU to use for BA, if available. (str, default: -1)

property ba_local_backend#

Bundle adjustment solver backend for local bundle adjustment. (BundleAdjustmentBackend, default: BundleAdjustmentBackend.CERES)

property ba_global_backend#

Bundle adjustment solver backend for global bundle adjustment. (BundleAdjustmentBackend, default: BundleAdjustmentBackend.CERES)

property use_prior_position#

Whether to use priors on the camera positions. (bool, default: False)

property use_robust_loss_on_prior_position#

Whether to use a robust loss on prior camera positions. (bool, default: False)

property prior_position_loss_scale#

Threshold on the residual for the robust position prior loss (chi2 for 3DOF at 95% = 7.815). (float, default: 7.815)

property snapshot_path#

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

property snapshot_frames_freq#

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

property image_path#

The image path at which to find the images to extract point colors. (PosixPath, default: .)

property image_names#

Optional list of image names to reconstruct. If no images are specified, all images will be reconstructed by default. (list, default: [])

property load_all_images#

Whether to load all images from the database, including those without correspondences. Only useful for triangulation. (bool, default: False)

property fix_existing_frames#

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

property constant_rigs#

List of rigs for which to fix the sensor_from_rig transformation, independent of ba_refine_sensor_from_rig. (set, default: set())

property constant_cameras#

List of cameras for which to fix the camera parameters independent of refine_focal_length, refine_principal_point, and refine_extra_params. (set, default: set())

property max_runtime_seconds#

Maximum runtime in seconds for the reconstruction process. If set to a non-positive value, the process will run until completion. (int, default: -1)

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, ba_local_num_images=6, ba_local_min_tri_angle=6.0, ba_global_ignore_redundant_points3D=False, ba_global_prune_points_min_coverage_gain=0.05, 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_frames=False, constant_rigs=set(), constant_cameras=set(), num_threads=-1, random_seed=-1, image_selection_method=ImageSelectionMethod.MIN_UNCERTAINTY))

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, random_seed=-1))

get_mapper(self: pycolmap.IncrementalPipelineOptions) pycolmap.IncrementalMapperOptions#

Get mapper options with shared settings applied.

get_triangulation(
self: pycolmap.IncrementalPipelineOptions,
) pycolmap.IncrementalTriangulatorOptions#

Get triangulation options with shared settings applied.

get_local_bundle_adjustment(
self: pycolmap.IncrementalPipelineOptions,
) pycolmap.BundleAdjustmentOptions#

Get local bundle adjustment options.

get_global_bundle_adjustment(
self: pycolmap.IncrementalPipelineOptions,
) pycolmap.BundleAdjustmentOptions#

Get global bundle adjustment options.

is_initial_pair_provided(self: pycolmap.IncrementalPipelineOptions) bool#

Check whether both initial image identifiers are provided.

check(self: pycolmap.IncrementalPipelineOptions) bool#
summary(self: pycolmap.IncrementalPipelineOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.IncrementalPipelineOptions, recursive: bool = True) dict#
class pycolmap.IncrementalPipelineCallback(*args, **kwargs)#

Members:

INITIAL_IMAGE_PAIR_REG_CALLBACK

NEXT_IMAGE_REG_CALLBACK

LAST_IMAGE_REG_CALLBACK

Overloaded function.

  1. __init__(self: pycolmap.IncrementalPipelineCallback, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.IncrementalPipelineCallback, name: str) None

property name#
property value#
INITIAL_IMAGE_PAIR_REG_CALLBACK = IncrementalPipelineCallback.INITIAL_IMAGE_PAIR_REG_CALLBACK#
NEXT_IMAGE_REG_CALLBACK = IncrementalPipelineCallback.NEXT_IMAGE_REG_CALLBACK#
LAST_IMAGE_REG_CALLBACK = IncrementalPipelineCallback.LAST_IMAGE_REG_CALLBACK#
class pycolmap.IncrementalPipelineStatus(*args, **kwargs)#

Members:

SUCCESS

INTERRUPTED

CONTINUE

STOP

UNKNOWN_SENSOR_FROM_RIG

NO_INITIAL_PAIR

BAD_INITIAL_PAIR

Overloaded function.

  1. __init__(self: pycolmap.IncrementalPipelineStatus, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.IncrementalPipelineStatus, name: str) None

property name#
property value#
SUCCESS = IncrementalPipelineStatus.SUCCESS#
INTERRUPTED = IncrementalPipelineStatus.INTERRUPTED#
CONTINUE = IncrementalPipelineStatus.CONTINUE#
STOP = IncrementalPipelineStatus.STOP#
UNKNOWN_SENSOR_FROM_RIG = IncrementalPipelineStatus.UNKNOWN_SENSOR_FROM_RIG#
NO_INITIAL_PAIR = IncrementalPipelineStatus.NO_INITIAL_PAIR#
BAD_INITIAL_PAIR = IncrementalPipelineStatus.BAD_INITIAL_PAIR#
class pycolmap.IncrementalPipeline(*args, **kwargs)#

Class that controls the incremental mapping procedure by iteratively initializing reconstructions from the same scene graph.

Overloaded function.

  1. __init__(self: pycolmap.IncrementalPipeline, options: pycolmap.IncrementalPipelineOptions, database: pycolmap.Database, reconstruction_manager: pycolmap.ReconstructionManager) None

  2. __init__(self: pycolmap.IncrementalPipeline, options: pycolmap.IncrementalPipelineOptions, database_cache: pycolmap.DatabaseCache, reconstruction_manager: pycolmap.ReconstructionManager) None

property options#
property reconstruction_manager#
property database_cache#
add_callback(
self: pycolmap.IncrementalPipeline,
id: SupportsInt | SupportsIndex,
func: collections.abc.Callable[[], None],
) None#

Add a callback function for the given callback type.

callback(self: pycolmap.IncrementalPipeline, id: SupportsInt | SupportsIndex) None#

Invoke the callback for the given callback type.

reconstruct(
self: pycolmap.IncrementalPipeline,
mapper: pycolmap.IncrementalMapper,
mapper_options: pycolmap.IncrementalMapperOptions,
continue_reconstruction: bool,
) pycolmap.IncrementalPipelineStatus#

Reconstruct the scene using the given mapper and options.

reconstruct_sub_model(
self: pycolmap.IncrementalPipeline,
mapper: pycolmap.IncrementalMapper,
mapper_options: pycolmap.IncrementalMapperOptions,
reconstruction: pycolmap.Reconstruction,
) pycolmap.IncrementalPipelineStatus#

Reconstruct a sub-model using the given mapper and options.

initialize_reconstruction(
self: pycolmap.IncrementalPipeline,
mapper: pycolmap.IncrementalMapper,
mapper_options: pycolmap.IncrementalMapperOptions,
reconstruction: pycolmap.Reconstruction,
) pycolmap.IncrementalPipelineStatus#

Initialize the reconstruction by finding and registering an initial image pair.

run(self: pycolmap.IncrementalPipeline) None#

Run the full incremental mapping pipeline.

check_run_global_refinement(
self: pycolmap.IncrementalPipeline,
reconstruction: pycolmap.Reconstruction,
ba_prev_num_reg_images: SupportsInt | SupportsIndex,
ba_prev_num_points: SupportsInt | SupportsIndex,
) bool#

Check whether global bundle adjustment should be run based on the growth of registered images and points.

check_reached_max_runtime(self: pycolmap.IncrementalPipeline) bool#

Check whether the maximum runtime has been reached.

class pycolmap.DepthMap(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.DepthMap) None

  2. __init__(self: pycolmap.DepthMap, width: typing.SupportsInt | typing.SupportsIndex, height: typing.SupportsInt | typing.SupportsIndex, depth_min: typing.SupportsFloat | typing.SupportsIndex, depth_max: typing.SupportsFloat | typing.SupportsIndex) None

to_array(self: pycolmap.DepthMap) numpy.typing.NDArray[numpy.float32]#
static from_array(
array: Annotated[numpy.typing.ArrayLike, numpy.float32],
depth_min: SupportsFloat | SupportsIndex,
depth_max: SupportsFloat | SupportsIndex,
) pycolmap.DepthMap#

Create depth map as a copy of array. Returns depth map with shape (H, W).

rescale(self: pycolmap.DepthMap, factor: SupportsFloat | SupportsIndex) None#

Rescale depth map.

downsize(
self: pycolmap.DepthMap,
max_width: SupportsInt | SupportsIndex,
max_height: SupportsInt | SupportsIndex,
) None#

Downsize depth map to fit maximum dimensions.

to_bitmap(
self: pycolmap.DepthMap,
min_percentile: SupportsFloat | SupportsIndex,
max_percentile: SupportsFloat | SupportsIndex,
) pycolmap.Bitmap#

Convert depth map to bitmap for visualization.

property width#

Width of the depth map.

property height#

Height of the depth map.

property depth_min#

Minimum depth value.

property depth_max#

Maximum depth value.

read(self: pycolmap.DepthMap, path: os.PathLike | str | bytes) None#

Read depth map from file at given path.

write(self: pycolmap.DepthMap, path: os.PathLike | str | bytes) None#

Write depth map to file at given path.

class pycolmap.NormalMap(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.NormalMap) None

  2. __init__(self: pycolmap.NormalMap, width: typing.SupportsInt | typing.SupportsIndex, height: typing.SupportsInt | typing.SupportsIndex) None

to_array(self: pycolmap.NormalMap) numpy.typing.NDArray[numpy.float32]#
static from_array(array: Annotated[numpy.typing.ArrayLike, numpy.float32]) pycolmap.NormalMap#

Create normal map as a copy of array. Returns normal map with shape (H, W, 3) where the 3 channels represent the x, y, z components of the normal vectors.

rescale(self: pycolmap.NormalMap, factor: SupportsFloat | SupportsIndex) None#

Rescale normal map.

downsize(
self: pycolmap.NormalMap,
max_width: SupportsInt | SupportsIndex,
max_height: SupportsInt | SupportsIndex,
) None#

Downsize normal map to fit maximum dimensions.

to_bitmap(self: pycolmap.NormalMap) pycolmap.Bitmap#

Convert normal map to bitmap for visualization.

property width#

Width of the normal map.

property height#

Height of the normal map.

read(self: pycolmap.NormalMap, path: os.PathLike | str | bytes) None#

Read normal map from file at given path.

write(self: pycolmap.NormalMap, path: os.PathLike | str | bytes) None#

Write normal map to file at given path.

class pycolmap.MVSModel(self: pycolmap.MVSModel)#
read(self: pycolmap.MVSModel, path: os.PathLike | str | bytes, format: str) None#

Read the model from the given path in the specified format.

read_from_colmap(
self: pycolmap.MVSModel,
path: os.PathLike | str | bytes,
sparse_path: os.PathLike | str | bytes = PosixPath('sparse'),
images_path: os.PathLike | str | bytes = PosixPath('images'),
) None#

Read the model from a COLMAP reconstruction.

read_from_pmvs(self: pycolmap.MVSModel, path: os.PathLike | str | bytes) None#

Read the model from PMVS output.

get_image_idx(self: pycolmap.MVSModel, name: str) int#

Get the image index for the given image name.

get_image_name(self: pycolmap.MVSModel, image_idx: SupportsInt | SupportsIndex) str#

Get the image name for the given image index.

get_max_overlapping_images(
self: pycolmap.MVSModel,
num_images: SupportsInt | SupportsIndex,
min_triangulation_angle: SupportsFloat | SupportsIndex,
) list[list[int]]#

Determine maximally overlapping images for each image, sorted by number of shared points subject to a minimum triangulation angle.

get_max_overlapping_images_from_pmvs(self: pycolmap.MVSModel) list[list[int]]#

Get overlapping images defined in the PMVS vis.dat file.

compute_depth_ranges(self: pycolmap.MVSModel) list[tuple[float, float]]#

Compute robust minimum and maximum depths from the sparse point cloud.

compute_shared_points(self: pycolmap.MVSModel) list[dict[int, int]]#

Compute the number of shared points between all overlapping images.

compute_triangulation_angles(
self: pycolmap.MVSModel,
percentile: SupportsFloat | SupportsIndex = 50.0,
) list[dict[int, float]]#

Compute the median triangulation angles between all overlapping images.

class pycolmap.CameraMode(*args, **kwargs)#

Members:

AUTO

SINGLE

PER_FOLDER

PER_IMAGE

Overloaded function.

  1. __init__(self: pycolmap.CameraMode, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.CameraMode, name: str) None

property name#
property value#
AUTO = CameraMode.AUTO#
SINGLE = CameraMode.SINGLE#
PER_FOLDER = CameraMode.PER_FOLDER#
PER_IMAGE = CameraMode.PER_IMAGE#
class pycolmap.ImageReaderOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.ImageReaderOptions) None

  2. __init__(self: pycolmap.ImageReaderOptions, arg0: dict) None

  3. __init__(self: pycolmap.ImageReaderOptions, **kwargs) None

property camera_model#

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

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). (PosixPath, default: .)

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 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 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) (PosixPath, default: .)

check(self: pycolmap.ImageReaderOptions) bool#
summary(self: pycolmap.ImageReaderOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.ImageReaderOptions, recursive: bool = True) dict#
class pycolmap.FileCopyType(*args, **kwargs)#

Members:

copy

softlink

hardlink

Overloaded function.

  1. __init__(self: pycolmap.FileCopyType, value: typing.SupportsInt | typing.SupportsIndex) None

  2. __init__(self: pycolmap.FileCopyType, name: str) None

property name#
property value#
copy = FileCopyType.copy#
pycolmap.import_images(
database_path: os.PathLike | str | bytes,
image_path: os.PathLike | str | bytes,
camera_mode: pycolmap.CameraMode = CameraMode.AUTO,
image_names: collections.abc.Sequence[str] = [],
options: pycolmap.ImageReaderOptions = ImageReaderOptions(),
) None#

Import images into a database

pycolmap.infer_camera_from_image(
image_path: os.PathLike | str | bytes,
options: pycolmap.ImageReaderOptions = ImageReaderOptions(),
) pycolmap.Camera#

Guess the camera parameters from the EXIF metadata

pycolmap.undistort_images(
output_path: os.PathLike | str | bytes,
input_path: os.PathLike | str | bytes,
image_path: os.PathLike | str | bytes,
image_names: collections.abc.Sequence[str] = [],
output_type: str = 'COLMAP',
copy_policy: pycolmap.FileCopyType = FileCopyType.copy,
num_patch_match_src_images: SupportsInt | SupportsIndex = -1,
undistort_options: pycolmap.UndistortCameraOptions = UndistortCameraOptions(),
jpeg_quality: SupportsInt | SupportsIndex = -1,
num_threads: SupportsInt | SupportsIndex = -1,
) None#

Undistort images

pycolmap.extract_features(
database_path: os.PathLike | str | bytes,
image_path: os.PathLike | str | bytes,
image_names: collections.abc.Sequence[str] = [],
camera_mode: pycolmap.CameraMode = CameraMode.AUTO,
reader_options: pycolmap.ImageReaderOptions = ImageReaderOptions(),
extraction_options: pycolmap.FeatureExtractionOptions = FeatureExtractionOptions(),
device: pycolmap.Device = Device.auto,
) None#

Extract SIFT Features and write them to database

class pycolmap.ExhaustivePairingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.ExhaustivePairingOptions) None

  2. __init__(self: pycolmap.ExhaustivePairingOptions, arg0: dict) None

  3. __init__(self: pycolmap.ExhaustivePairingOptions, **kwargs) None

property block_size#

(int, default: 50)

check(self: pycolmap.ExhaustivePairingOptions) bool#
summary(self: pycolmap.ExhaustivePairingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.ExhaustivePairingOptions, recursive: bool = True) dict#
class pycolmap.SpatialPairingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.SpatialPairingOptions) None

  2. __init__(self: pycolmap.SpatialPairingOptions, arg0: dict) None

  3. __init__(self: pycolmap.SpatialPairingOptions, **kwargs) None

property ignore_z#

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

property max_num_neighbors#

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

property min_num_neighbors#

The minimum number of nearest neighbors to match. Neighbors include those within max_distance or to satisfy min_num_neighbors. (int, default: 0)

property max_distance#

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

property num_threads#

(int, default: -1)

check(self: pycolmap.SpatialPairingOptions) bool#
summary(self: pycolmap.SpatialPairingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.SpatialPairingOptions, recursive: bool = True) dict#
class pycolmap.VocabTreePairingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.VocabTreePairingOptions) None

  2. __init__(self: pycolmap.VocabTreePairingOptions, arg0: dict) None

  3. __init__(self: pycolmap.VocabTreePairingOptions, **kwargs) None

property num_images#

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

property num_nearest_neighbors#

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

property num_checks#

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

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 max_num_features#

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

property vocab_tree_path#

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

property match_list_path#

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

property num_threads#

(int, default: -1)

check(self: pycolmap.VocabTreePairingOptions) bool#
summary(self: pycolmap.VocabTreePairingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.VocabTreePairingOptions, recursive: bool = True) dict#
class pycolmap.SequentialPairingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.SequentialPairingOptions) None

  2. __init__(self: pycolmap.SequentialPairingOptions, arg0: dict) None

  3. __init__(self: pycolmap.SequentialPairingOptions, **kwargs) 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)

property expand_rig_images#

Whether to match an image against all images in neighboring rig frames. If no rigs/frames are configured in the database, this option is ignored. (bool, default: True)

property loop_detection#

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

property loop_detection_period#

The frequency at which loop detection is triggered, in number of images. (int, default: 10)

property loop_detection_num_images#

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

property loop_detection_num_nearest_neighbors#

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

property loop_detection_num_checks#

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

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_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 vocab_tree_path#

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

property num_threads#

Number of threads for loop detection indexing and retrieval. (int, default: -1)

vocab_tree_options(self: pycolmap.SequentialPairingOptions) pycolmap.VocabTreePairingOptions#
check(self: pycolmap.SequentialPairingOptions) bool#
summary(self: pycolmap.SequentialPairingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.SequentialPairingOptions, recursive: bool = True) dict#
class pycolmap.ImportedPairingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.ImportedPairingOptions) None

  2. __init__(self: pycolmap.ImportedPairingOptions, arg0: dict) None

  3. __init__(self: pycolmap.ImportedPairingOptions, **kwargs) None

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. (PosixPath, default: .)

check(self: pycolmap.ImportedPairingOptions) bool#
summary(self: pycolmap.ImportedPairingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.ImportedPairingOptions, recursive: bool = True) dict#
class pycolmap.ExistingMatchedPairingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.ExistingMatchedPairingOptions) None

  2. __init__(self: pycolmap.ExistingMatchedPairingOptions, arg0: dict) None

  3. __init__(self: pycolmap.ExistingMatchedPairingOptions, **kwargs) None

property batch_size#

(int, default: 1000)

check(self: pycolmap.ExistingMatchedPairingOptions) bool#
summary(self: pycolmap.ExistingMatchedPairingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.ExistingMatchedPairingOptions, recursive: bool = True) dict#
class pycolmap.GeometricVerifierOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.GeometricVerifierOptions) None

  2. __init__(self: pycolmap.GeometricVerifierOptions, arg0: dict) None

  3. __init__(self: pycolmap.GeometricVerifierOptions, **kwargs) None

property num_threads#

(int, default: -1)

property rig_verification#

(bool, default: False)

property use_existing_relative_pose#

(bool, default: False)

summary(self: pycolmap.GeometricVerifierOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.GeometricVerifierOptions, recursive: bool = True) dict#
pycolmap.match_exhaustive(
database_path: os.PathLike | str | bytes,
matching_options: pycolmap.FeatureMatchingOptions = FeatureMatchingOptions(),
pairing_options: pycolmap.ExhaustivePairingOptions = ExhaustivePairingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = Device.auto,
) None#

Exhaustive feature matching

pycolmap.match_spatial(
database_path: os.PathLike | str | bytes,
matching_options: pycolmap.FeatureMatchingOptions = FeatureMatchingOptions(),
pairing_options: pycolmap.SpatialPairingOptions = SpatialPairingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = Device.auto,
) None#

Spatial feature matching

pycolmap.match_vocabtree(
database_path: os.PathLike | str | bytes,
matching_options: pycolmap.FeatureMatchingOptions = FeatureMatchingOptions(),
pairing_options: pycolmap.VocabTreePairingOptions = VocabTreePairingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = Device.auto,
) None#

Vocab tree feature matching

pycolmap.match_sequential(
database_path: os.PathLike | str | bytes,
matching_options: pycolmap.FeatureMatchingOptions = FeatureMatchingOptions(),
pairing_options: pycolmap.SequentialPairingOptions = SequentialPairingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = Device.auto,
) None#

Sequential feature matching

pycolmap.match_image_pairs(
database_path: os.PathLike | str | bytes,
matching_options: pycolmap.FeatureMatchingOptions = FeatureMatchingOptions(),
pairing_options: pycolmap.ImportedPairingOptions = ImportedPairingOptions(),
verification_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
device: pycolmap.Device = Device.auto,
) None#

Match features between image pairs specified in a file

pycolmap.verify_matches(
database_path: os.PathLike | str | bytes,
pairs_path: os.PathLike | str | bytes,
options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
) None#

Run geometric verification of the matches

pycolmap.geometric_verification(
database_path: os.PathLike | str | bytes,
verifier_options: pycolmap.GeometricVerifierOptions = GeometricVerifierOptions(),
pairing_options: pycolmap.ExistingMatchedPairingOptions = ExistingMatchedPairingOptions(),
two_view_geometry_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
) None#

Run geometric verification on all image pairs in the database

pycolmap.guided_geometric_verification(
reconstruction: pycolmap.Reconstruction,
database_path: os.PathLike | str | bytes,
pairing_options: pycolmap.ExistingMatchedPairingOptions = ExistingMatchedPairingOptions(),
two_view_geometry_options: pycolmap.TwoViewGeometryOptions = TwoViewGeometryOptions(),
num_threads: SupportsInt | SupportsIndex = -1,
) None#

Run geometric verification given an existing colmap reconstruction on all image pairs in the database

class pycolmap.PairGenerator#
reset(self: pycolmap.PairGenerator) None#
has_finished(self: pycolmap.PairGenerator) bool#
next(self: pycolmap.PairGenerator) list[tuple[int, int]]#
all_pairs(self: pycolmap.PairGenerator) list[tuple[int, int]]#
class pycolmap.ExhaustivePairGenerator(
self: pycolmap.ExhaustivePairGenerator,
options: pycolmap.ExhaustivePairingOptions,
database: pycolmap.Database,
)#
class pycolmap.VocabTreePairGenerator(
self: pycolmap.VocabTreePairGenerator,
options: pycolmap.VocabTreePairingOptions,
database: pycolmap.Database,
query_image_ids: collections.abc.Sequence[SupportsInt | SupportsIndex] = [],
)#
class pycolmap.SequentialPairGenerator(
self: pycolmap.SequentialPairGenerator,
options: pycolmap.SequentialPairingOptions,
database: pycolmap.Database,
)#
class pycolmap.SpatialPairGenerator(
self: pycolmap.SpatialPairGenerator,
options: pycolmap.SpatialPairingOptions,
database: pycolmap.Database,
)#
class pycolmap.ImportedPairGenerator(
self: pycolmap.ImportedPairGenerator,
options: pycolmap.ImportedPairingOptions,
database: pycolmap.Database,
)#
class pycolmap.ViewGraphCalibrationOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.ViewGraphCalibrationOptions) None

  2. __init__(self: pycolmap.ViewGraphCalibrationOptions, arg0: dict) None

  3. __init__(self: pycolmap.ViewGraphCalibrationOptions, **kwargs) None

property random_seed#

(int, default: -1)

property cross_validate_prior_focal_lengths#

(bool, default: True)

property min_calibrated_pair_ratio#

(float, default: 0.5)

property reestimate_relative_pose#

(bool, default: True)

property min_focal_length_ratio#

(float, default: 0.1)

property max_focal_length_ratio#

(float, default: 10.0)

property max_calibration_error#

(float, default: 2.0)

property loss_function_scale#

(float, default: 0.01)

property relpose_max_error#

(float, default: 1.0)

property relpose_min_num_inliers#

(int, default: 30)

property relpose_min_inlier_ratio#

(float, default: 0.25)

summary(self: pycolmap.ViewGraphCalibrationOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.ViewGraphCalibrationOptions, recursive: bool = True) dict#
class pycolmap.GlobalMapperOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.GlobalMapperOptions) None

  2. __init__(self: pycolmap.GlobalMapperOptions, arg0: dict) None

  3. __init__(self: pycolmap.GlobalMapperOptions, **kwargs) None

property num_threads#

(int, default: -1)

property random_seed#

(int, default: -1)

property refine_sensor_from_rig#

When False, treat each non-ref sensor’s cam_from_rig as a pre-calibrated constant across rotation averaging, global positioning and bundle adjustment. (bool, default: True)

property rotation_averaging#

(RotationEstimatorOptions, default: RotationEstimatorOptions(random_seed=-1, max_num_l1_iterations=5, l1_step_convergence_threshold=0.001, max_num_irls_iterations=100, irls_step_convergence_threshold=0.001, gravity_dir=[0. 1. 0.], irls_loss_parameter_sigma=5.0, ridge_regularization=1e-09, weight_type=RotationWeightType.GEMAN_MCCLURE, skip_initialization=False, use_gravity=False, use_stratified=True, filter_unregistered=False, max_rotation_error_deg=10.0, refine_sensor_from_rig=True, reweighting=RotationAveragingReweighting.UNIFORM))

property global_positioning#

(GlobalPositionerOptions, default: GlobalPositionerOptions(generate_random_positions=True, generate_random_points=True, generate_scales=True, optimize_positions=True, optimize_points=True, optimize_scales=True, refine_sensor_from_rig=True, use_gpu=True, gpu_index=’-1’, min_num_images_gpu_solver=50, min_num_view_per_track=3, random_seed=-1, loss_function_scale=0.1, use_parameter_block_ordering=True))

property bundle_adjustment#

(BundleAdjustmentOptions, default: BundleAdjustmentOptions(refine_focal_length=True, refine_principal_point=False, refine_extra_params=True, refine_rig_from_world=True, refine_sensor_from_rig=True, constant_rig_from_world_rotation=False, refine_points3D=True, min_track_length=3, print_summary=False, backend=BundleAdjustmentBackend.CERES, ceres=CeresBundleAdjustmentOptions(loss_function_type=LossFunctionType.HUBER, loss_function_scale=1.0, use_gpu=True, gpu_index=’-1’, solver_options=SolverOptions(minimizer_type=MinimizerType.TRUST_REGION, line_search_direction_type=LineSearchDirectionType.LBFGS, line_search_type=LineSearchType.WOLFE, nonlinear_conjugate_gradient_type=NonlinearConjugateGradientType.FLETCHER_REEVES, max_lbfgs_rank=20, use_approximate_eigenvalue_bfgs_scaling=False, line_search_interpolation_type=LineSearchInterpolationType.CUBIC, min_line_search_step_size=1e-09, line_search_sufficient_function_decrease=0.0001, max_line_search_step_contraction=0.001, min_line_search_step_contraction=0.6, max_num_line_search_step_size_iterations=20, max_num_line_search_direction_restarts=5, line_search_sufficient_curvature_decrease=0.9, max_line_search_step_expansion=10.0, trust_region_strategy_type=TrustRegionStrategyType.LEVENBERG_MARQUARDT, dogleg_type=DoglegType.TRADITIONAL_DOGLEG, use_nonmonotonic_steps=False, max_consecutive_nonmonotonic_steps=10, max_num_iterations=200, max_solver_time_in_seconds=1000000000.0, num_threads=-1, initial_trust_region_radius=10000.0, max_trust_region_radius=1e+16, min_trust_region_radius=1e-32, min_relative_decrease=0.001, min_lm_diagonal=1e-06, max_lm_diagonal=1e+32, max_num_consecutive_invalid_steps=10, function_tolerance=1e-05, gradient_tolerance=0.0001, parameter_tolerance=0.0, linear_solver_type=LinearSolverType.SPARSE_SCHUR, preconditioner_type=PreconditionerType.JACOBI, visibility_clustering_type=VisibilityClusteringType.CANONICAL_VIEWS, dense_linear_algebra_library_type=DenseLinearAlgebraLibraryType.EIGEN, sparse_linear_algebra_library_type=SparseLinearAlgebraLibraryType.SUITE_SPARSE, use_explicit_schur_complement=False, dynamic_sparsity=False, use_inner_iterations=False, inner_iteration_tolerance=0.001, min_linear_solver_iterations=0, max_linear_solver_iterations=200, eta=0.1, jacobi_scaling=True, logging_type=LoggingType.SILENT, minimizer_progress_to_stdout=False, trust_region_problem_dump_directory=’/tmp’, trust_region_problem_dump_format_type=DumpFormatType.TEXTFILE, check_gradients=False, gradient_check_relative_precision=1e-08, gradient_check_numeric_derivative_relative_step_size=1e-06, update_state_every_iteration=False), min_num_images_gpu_solver=50, min_num_residuals_for_cpu_multi_threading=50000, max_num_images_direct_dense_cpu_solver=50, max_num_images_direct_sparse_cpu_solver=1000, max_num_images_direct_dense_gpu_solver=200, max_num_images_direct_sparse_gpu_solver=4000, auto_select_solver_type=False), caspar=CasparBundleAdjustmentOptions(solver_iter_max=200, pcg_iter_max=20, diag_init=1.0, diag_min=1e-12, diag_scaling_up=2.0, diag_scaling_down=0.333333, diag_exit_value=1000.0, score_exit_value=0.0, pcg_rel_error_exit=0.0001, pcg_rel_score_exit=-1.0, pcg_rel_decrease_min=-1.0, solver_rel_decrease_min=1.0, gpu_index=’-1’)))

property retriangulation#

(IncrementalTriangulatorOptions, default: IncrementalTriangulatorOptions(max_transitivity=1, create_max_angle_error=2.0, continue_max_angle_error=2.0, merge_max_reproj_error=15.0, complete_max_reproj_error=15.0, complete_max_transitivity=5, re_max_angle_error=5.0, re_min_ratio=0.2, re_max_trials=1, min_angle=1.0, ignore_two_view_tracks=True, min_focal_length_ratio=0.1, max_focal_length_ratio=10.0, max_extra_param=1.0, random_seed=-1))

property track_intra_image_consistency_threshold#

(float, default: 10.0)

property track_required_tracks_per_view#

(int, default: 2147483647)

property track_min_num_views_per_track#

(int, default: 3)

property keep_max_num_tracks#

(int, default: 2147483647)

property max_angular_reproj_error_deg#

(float, default: 1.0)

property max_normalized_reproj_error#

(float, default: 0.01)

property min_tri_angle_deg#

(float, default: 1.0)

property ba_num_iterations#

(int, default: 3)

property ba_skip_fixed_rotation_stage#

(bool, default: False)

property ba_skip_joint_optimization_stage#

(bool, default: False)

property skip_rotation_averaging#

(bool, default: False)

property skip_track_establishment#

(bool, default: False)

property skip_global_positioning#

(bool, default: False)

property skip_bundle_adjustment#

(bool, default: False)

property skip_retriangulation#

(bool, default: False)

summary(self: pycolmap.GlobalMapperOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.GlobalMapperOptions, recursive: bool = True) dict#
class pycolmap.GlobalPipelineOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.GlobalPipelineOptions) None

  2. __init__(self: pycolmap.GlobalPipelineOptions, arg0: dict) None

  3. __init__(self: pycolmap.GlobalPipelineOptions, **kwargs) None

property min_num_matches#

(int, default: 15)

property ignore_watermarks#

(bool, default: False)

property image_names#

(list, default: [])

property num_threads#

(int, default: -1)

property random_seed#

(int, default: -1)

property decompose_relative_pose#

(bool, default: True)

property mapper#

(GlobalMapperOptions, default: GlobalMapperOptions(num_threads=-1, random_seed=-1, refine_sensor_from_rig=True, rotation_averaging=RotationEstimatorOptions(random_seed=-1, max_num_l1_iterations=5, l1_step_convergence_threshold=0.001, max_num_irls_iterations=100, irls_step_convergence_threshold=0.001, gravity_dir=[0. 1. 0.], irls_loss_parameter_sigma=5.0, ridge_regularization=1e-09, weight_type=RotationWeightType.GEMAN_MCCLURE, skip_initialization=False, use_gravity=False, use_stratified=True, filter_unregistered=False, max_rotation_error_deg=10.0, refine_sensor_from_rig=True, reweighting=RotationAveragingReweighting.UNIFORM), global_positioning=GlobalPositionerOptions(generate_random_positions=True, generate_random_points=True, generate_scales=True, optimize_positions=True, optimize_points=True, optimize_scales=True, refine_sensor_from_rig=True, use_gpu=True, gpu_index=’-1’, min_num_images_gpu_solver=50, min_num_view_per_track=3, random_seed=-1, loss_function_scale=0.1, use_parameter_block_ordering=True), bundle_adjustment=BundleAdjustmentOptions(refine_focal_length=True, refine_principal_point=False, refine_extra_params=True, refine_rig_from_world=True, refine_sensor_from_rig=True, constant_rig_from_world_rotation=False, refine_points3D=True, min_track_length=3, print_summary=False, backend=BundleAdjustmentBackend.CERES, ceres=CeresBundleAdjustmentOptions(loss_function_type=LossFunctionType.HUBER, loss_function_scale=1.0, use_gpu=True, gpu_index=’-1’, solver_options=SolverOptions(minimizer_type=MinimizerType.TRUST_REGION, line_search_direction_type=LineSearchDirectionType.LBFGS, line_search_type=LineSearchType.WOLFE, nonlinear_conjugate_gradient_type=NonlinearConjugateGradientType.FLETCHER_REEVES, max_lbfgs_rank=20, use_approximate_eigenvalue_bfgs_scaling=False, line_search_interpolation_type=LineSearchInterpolationType.CUBIC, min_line_search_step_size=1e-09, line_search_sufficient_function_decrease=0.0001, max_line_search_step_contraction=0.001, min_line_search_step_contraction=0.6, max_num_line_search_step_size_iterations=20, max_num_line_search_direction_restarts=5, line_search_sufficient_curvature_decrease=0.9, max_line_search_step_expansion=10.0, trust_region_strategy_type=TrustRegionStrategyType.LEVENBERG_MARQUARDT, dogleg_type=DoglegType.TRADITIONAL_DOGLEG, use_nonmonotonic_steps=False, max_consecutive_nonmonotonic_steps=10, max_num_iterations=200, max_solver_time_in_seconds=1000000000.0, num_threads=-1, initial_trust_region_radius=10000.0, max_trust_region_radius=1e+16, min_trust_region_radius=1e-32, min_relative_decrease=0.001, min_lm_diagonal=1e-06, max_lm_diagonal=1e+32, max_num_consecutive_invalid_steps=10, function_tolerance=1e-05, gradient_tolerance=0.0001, parameter_tolerance=0.0, linear_solver_type=LinearSolverType.SPARSE_SCHUR, preconditioner_type=PreconditionerType.JACOBI, visibility_clustering_type=VisibilityClusteringType.CANONICAL_VIEWS, dense_linear_algebra_library_type=DenseLinearAlgebraLibraryType.EIGEN, sparse_linear_algebra_library_type=SparseLinearAlgebraLibraryType.SUITE_SPARSE, use_explicit_schur_complement=False, dynamic_sparsity=False, use_inner_iterations=False, inner_iteration_tolerance=0.001, min_linear_solver_iterations=0, max_linear_solver_iterations=200, eta=0.1, jacobi_scaling=True, logging_type=LoggingType.SILENT, minimizer_progress_to_stdout=False, trust_region_problem_dump_directory=’/tmp’, trust_region_problem_dump_format_type=DumpFormatType.TEXTFILE, check_gradients=False, gradient_check_relative_precision=1e-08, gradient_check_numeric_derivative_relative_step_size=1e-06, update_state_every_iteration=False), min_num_images_gpu_solver=50, min_num_residuals_for_cpu_multi_threading=50000, max_num_images_direct_dense_cpu_solver=50, max_num_images_direct_sparse_cpu_solver=1000, max_num_images_direct_dense_gpu_solver=200, max_num_images_direct_sparse_gpu_solver=4000, auto_select_solver_type=False), caspar=CasparBundleAdjustmentOptions(solver_iter_max=200, pcg_iter_max=20, diag_init=1.0, diag_min=1e-12, diag_scaling_up=2.0, diag_scaling_down=0.333333, diag_exit_value=1000.0, score_exit_value=0.0, pcg_rel_error_exit=0.0001, pcg_rel_score_exit=-1.0, pcg_rel_decrease_min=-1.0, solver_rel_decrease_min=1.0, gpu_index=’-1’)), retriangulation=IncrementalTriangulatorOptions(max_transitivity=1, create_max_angle_error=2.0, continue_max_angle_error=2.0, merge_max_reproj_error=15.0, complete_max_reproj_error=15.0, complete_max_transitivity=5, re_max_angle_error=5.0, re_min_ratio=0.2, re_max_trials=1, min_angle=1.0, ignore_two_view_tracks=True, min_focal_length_ratio=0.1, max_focal_length_ratio=10.0, max_extra_param=1.0, random_seed=-1), track_intra_image_consistency_threshold=10.0, track_required_tracks_per_view=2147483647, track_min_num_views_per_track=3, keep_max_num_tracks=2147483647, max_angular_reproj_error_deg=1.0, max_normalized_reproj_error=0.01, min_tri_angle_deg=1.0, ba_num_iterations=3, ba_skip_fixed_rotation_stage=False, ba_skip_joint_optimization_stage=False, skip_rotation_averaging=False, skip_track_establishment=False, skip_global_positioning=False, skip_bundle_adjustment=False, skip_retriangulation=False))

summary(self: pycolmap.GlobalPipelineOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.GlobalPipelineOptions, recursive: bool = True) dict#
pycolmap.triangulate_points(
reconstruction: pycolmap.Reconstruction,
database_path: os.PathLike | str | bytes,
image_path: os.PathLike | str | bytes,
output_path: os.PathLike | str | bytes,
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: os.PathLike | str | bytes,
image_path: os.PathLike | str | bytes,
output_path: os.PathLike | str | bytes,
options: pycolmap.IncrementalPipelineOptions = IncrementalPipelineOptions(),
input_path: os.PathLike | str | bytes = '',
initial_image_pair_callback: collections.abc.Callable[[], None] = None,
next_image_callback: collections.abc.Callable[[], None] = None,
) dict[int, pycolmap.Reconstruction]#

Recover 3D points and unknown camera poses

pycolmap.global_mapping(
database_path: os.PathLike | str | bytes,
image_path: os.PathLike | str | bytes,
output_path: os.PathLike | str | bytes,
options: pycolmap.GlobalPipelineOptions = GlobalPipelineOptions(),
) dict[int, pycolmap.Reconstruction]#

Recover 3D points and camera poses using global SfM (GLOMAP)

pycolmap.calibrate_view_graph(
database_path: os.PathLike | str | bytes,
options: pycolmap.ViewGraphCalibrationOptions = ViewGraphCalibrationOptions(),
) bool#

Calibrate focal lengths from fundamental matrices and upgrade two-view geometries to CALIBRATED in the database. Run before global_mapping when reliable intrinsics are unavailable.

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

Jointly refine 3D points and camera poses

class pycolmap.PatchMatchOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.PatchMatchOptions) None

  2. __init__(self: pycolmap.PatchMatchOptions, arg0: dict) None

  3. __init__(self: pycolmap.PatchMatchOptions, **kwargs) None

property max_image_size#

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

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 depth_min#

(float, default: -1.0)

property depth_max#

(float, default: -1.0)

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 sigma_spatial#

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

property sigma_color#

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

property num_samples#

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

property ncc_sigma#

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

property min_triangulation_angle#

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

property incident_angle_sigma#

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

property num_iterations#

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

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_regularizer#

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

property geom_consistency_max_cost#

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

property filter#

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

property filter_min_ncc#

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

property filter_min_triangulation_angle#

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

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_geom_consistency_max_cost#

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

property cache_size#

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

property allow_missing_files#

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

property write_consistency_graph#

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

property num_threads#

Number of threads for processing. -1 uses all available threads. (int, default: -1)

check(self: pycolmap.PatchMatchOptions) bool#
summary(self: pycolmap.PatchMatchOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.PatchMatchOptions, recursive: bool = True) dict#
pycolmap.patch_match_stereo(
workspace_path: os.PathLike | str | bytes,
workspace_format: str = 'COLMAP',
pmvs_option_name: str = 'option-all',
options: pycolmap.PatchMatchOptions = PatchMatchOptions(),
config_path: os.PathLike | str | bytes = '',
) None#

Runs Patch-Match-Stereo (requires CUDA)

class pycolmap.StereoFusionOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.StereoFusionOptions) None

  2. __init__(self: pycolmap.StereoFusionOptions, arg0: dict) None

  3. __init__(self: pycolmap.StereoFusionOptions, **kwargs) None

property mask_path#

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

property num_threads#

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

property max_image_size#

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

property min_num_pixels#

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

property max_num_pixels#

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

property max_traversal_depth#

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

property max_reproj_error#

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

property max_depth_error#

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

property max_normal_error#

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

property check_num_images#

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

property use_cache#

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

property cache_size#

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

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)))

check(self: pycolmap.StereoFusionOptions) bool#
summary(self: pycolmap.StereoFusionOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.StereoFusionOptions, recursive: bool = True) dict#
pycolmap.stereo_fusion(
output_path: os.PathLike | str | bytes,
workspace_path: os.PathLike | str | bytes,
workspace_format: str = 'COLMAP',
pmvs_option_name: str = 'option-all',
input_type: str = 'geometric',
options: pycolmap.StereoFusionOptions = StereoFusionOptions(),
output_type: str = 'bin',
) pycolmap.Reconstruction#

Stereo Fusion

class pycolmap.PoissonMeshingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.PoissonMeshingOptions) None

  2. __init__(self: pycolmap.PoissonMeshingOptions, arg0: dict) None

  3. __init__(self: pycolmap.PoissonMeshingOptions, **kwargs) None

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)

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)

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. (bool, default: True)

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)

property num_threads#

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

check(self: pycolmap.PoissonMeshingOptions) bool#
summary(self: pycolmap.PoissonMeshingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.PoissonMeshingOptions, recursive: bool = True) dict#
class pycolmap.DelaunayMeshingOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.DelaunayMeshingOptions) None

  2. __init__(self: pycolmap.DelaunayMeshingOptions, arg0: dict) None

  3. __init__(self: pycolmap.DelaunayMeshingOptions, **kwargs) None

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_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 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)

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 quality_regularization#

A higher quality regularization leads to a smoother surface. (float, default: 1.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)

property num_threads#

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

check(self: pycolmap.DelaunayMeshingOptions) bool#
summary(self: pycolmap.DelaunayMeshingOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.DelaunayMeshingOptions, recursive: bool = True) dict#
pycolmap.poisson_meshing(
input_path: os.PathLike | str | bytes,
output_path: os.PathLike | str | bytes,
options: pycolmap.PoissonMeshingOptions = PoissonMeshingOptions(),
) None#

Perform Poisson surface reconstruction and return true if successful.

class pycolmap.MeshSimplificationOptions(*args, **kwargs)#

Overloaded function.

  1. __init__(self: pycolmap.MeshSimplificationOptions) None

  2. __init__(self: pycolmap.MeshSimplificationOptions, arg0: dict) None

  3. __init__(self: pycolmap.MeshSimplificationOptions, **kwargs) None

property target_face_ratio#

Fraction of faces to retain, in (0, 1]. (float, default: 0.1)

property max_error#

Maximum quadric error per collapse; 0 = disabled. (float, default: 0.0)

property boundary_weight#

Penalty weight for boundary edges; 0 = disabled. (float, default: 1000.0)

property interpolate_colors#

Blend colors on collapse vs. pick lower-error vertex. (bool, default: True)

property num_threads#

The number of threads to use for initialization. -1 = all threads. (int, default: -1)

check(self: pycolmap.MeshSimplificationOptions) bool#
summary(self: pycolmap.MeshSimplificationOptions, write_type: bool = False) str#
mergedict(self: object, kwargs: dict) None#
todict(self: pycolmap.MeshSimplificationOptions, recursive: bool = True) dict#
pycolmap.simplify_mesh(
input_path: os.PathLike | str | bytes,
output_path: os.PathLike | str | bytes,
options: pycolmap.MeshSimplificationOptions = MeshSimplificationOptions(),
) None#

Read a PLY mesh, simplify it using QEM decimation, and write the result.

pycolmap.set_random_seed(seed: SupportsInt | SupportsIndex) None#

Initialize the PRNG with the given seed.

class pycolmap.ostream(self: pycolmap.ostream, stdout: bool = True, stderr: bool = True)#