limap.pointsfm package

Submodules

limap.pointsfm.bundler_reader module

limap.pointsfm.bundler_reader.ReadModelBundler(bundler_path, list_path, model_path)

limap.pointsfm.colmap_reader module

limap.pointsfm.colmap_reader.PyReadCOLMAP(colmap_path, model_path=None)
limap.pointsfm.colmap_reader.ReadInfos(colmap_path, model_path='sparse', image_path='images')
limap.pointsfm.colmap_reader.ReadPointTracks(colmap_reconstruction)
limap.pointsfm.colmap_reader.check_exists_colmap_model(model_path)

limap.pointsfm.colmap_sfm module

limap.pointsfm.colmap_sfm.import_images_with_known_cameras(image_dir, database_path, imagecols)
limap.pointsfm.colmap_sfm.run_colmap_sfm(cfg, imagecols, output_path='tmp/tmp_colmap', keypoints=None, skip_exists=False, map_to_original_image_names=True, neighbors=None)
limap.pointsfm.colmap_sfm.run_colmap_sfm_with_known_poses(cfg, imagecols, output_path='tmp/tmp_colmap', keypoints=None, skip_exists=False, map_to_original_image_names=False, neighbors=None)
limap.pointsfm.colmap_sfm.run_hloc_matches(cfg, image_path, db_path, keypoints=None, neighbors=None, imagecols=None)

Inputs: - neighbors: map<int, std::vector<int>> to avoid exhaustive matches - imagecols: optionally use the id mapping from _base.ImageCollection to do the match

limap.pointsfm.colmap_sfm.write_pairs_from_neighbors(output_path, image_path, neighbors, image_ids)

limap.pointsfm.database module

class limap.pointsfm.database.COLMAPDatabase(*args, **kwargs)

Bases: Connection

add_camera(model, width, height, params, prior_focal_length=False, camera_id=None)
add_descriptors(image_id, descriptors)
add_image(name, camera_id, prior_q=array([nan, nan, nan, nan]), prior_t=array([nan, nan, nan]), image_id=None)
add_keypoints(image_id, keypoints)
add_matches(image_id1, image_id2, matches)
add_two_view_geometry(image_id1, image_id2, matches, F=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), E=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), H=array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), qvec=array([1., 0., 0., 0.]), tvec=array([0., 0., 0.]), config=2)
static connect(database_path)
limap.pointsfm.database.array_to_blob(array)
limap.pointsfm.database.blob_to_array(blob, dtype, shape=(-1,))
limap.pointsfm.database.example_usage()
limap.pointsfm.database.image_ids_to_pair_id(image_id1, image_id2)
limap.pointsfm.database.pair_id_to_image_ids(pair_id)

limap.pointsfm.functions module

limap.pointsfm.functions.ComputeNeighbors(model, n_neighbors, min_triangulation_angle=1.0, neighbor_type='iou')

Returns: map<int, vector<int>>

limap.pointsfm.functions.compute_metainfos(cfg, model, n_neighbors=20)
limap.pointsfm.functions.filter_by_cam_id(cam_id, prev_imagecols, prev_neighbors)

Filter _base.ImageCollection by cam id

limap.pointsfm.functions.read_infos_bundler(cfg, bundler_path, list_path, model_path, compute_neighbors=True, n_neighbors=20)

Read all infos from Bundler format including imagecols, neighbors, ranges

limap.pointsfm.functions.read_infos_colmap(cfg, colmap_path, model_path='sparse', image_path='images', compute_neighbors=True, n_neighbors=20)

Read all infos from colmap including imagecols, neighbors, and ranges

limap.pointsfm.functions.read_infos_visualsfm(cfg, vsfm_path, nvm_file='reconstruction.nvm', compute_neighbors=True, n_neighbors=20)

Read all infos from VisualSfM format including imagecols, neighbors, ranges

limap.pointsfm.model_converter module

limap.pointsfm.model_converter.convert_colmap_to_visualsfm(colmap_model_path, output_nvm_file)
limap.pointsfm.model_converter.convert_imagecols_to_colmap(imagecols, colmap_output_path)

limap.pointsfm.read_write_model module

limap.pointsfm.read_write_model.BaseImage

Image(id, qvec, tvec, camera_id, name, xys, point3D_ids)

namedtuple limap.pointsfm.read_write_model.Camera(id, model, width, height, params)

Bases: namedtuple()

Camera(id, model, width, height, params)

Fields:
  1.  id – Alias for field number 0

  2.  model – Alias for field number 1

  3.  width – Alias for field number 2

  4.  height – Alias for field number 3

  5.  params – Alias for field number 4

namedtuple limap.pointsfm.read_write_model.CameraModel(model_id, model_name, num_params)

Bases: namedtuple()

CameraModel(model_id, model_name, num_params)

Fields:
  1.  model_id – Alias for field number 0

  2.  model_name – Alias for field number 1

  3.  num_params – Alias for field number 2

namedtuple limap.pointsfm.read_write_model.Image(id, qvec, tvec, camera_id, name, xys, point3D_ids)

Bases: Image

Fields:
  1.  id – Alias for field number 0

  2.  qvec – Alias for field number 1

  3.  tvec – Alias for field number 2

  4.  camera_id – Alias for field number 3

  5.  name – Alias for field number 4

  6.  xys – Alias for field number 5

  7.  point3D_ids – Alias for field number 6

qvec2rotmat()
namedtuple limap.pointsfm.read_write_model.Point3D(id, xyz, rgb, error, image_ids, point2D_idxs)

Bases: namedtuple()

Point3D(id, xyz, rgb, error, image_ids, point2D_idxs)

Fields:
  1.  id – Alias for field number 0

  2.  xyz – Alias for field number 1

  3.  rgb – Alias for field number 2

  4.  error – Alias for field number 3

  5.  image_ids – Alias for field number 4

  6.  point2D_idxs – Alias for field number 5

limap.pointsfm.read_write_model.detect_model_format(path, ext)
limap.pointsfm.read_write_model.main()
limap.pointsfm.read_write_model.qvec2rotmat(qvec)
limap.pointsfm.read_write_model.read_cameras_binary(path_to_model_file)
see: src/base/reconstruction.cc

void Reconstruction::WriteCamerasBinary(const std::string& path) void Reconstruction::ReadCamerasBinary(const std::string& path)

limap.pointsfm.read_write_model.read_cameras_text(path)
see: src/base/reconstruction.cc

void Reconstruction::WriteCamerasText(const std::string& path) void Reconstruction::ReadCamerasText(const std::string& path)

limap.pointsfm.read_write_model.read_images_binary(path_to_model_file)
see: src/base/reconstruction.cc

void Reconstruction::ReadImagesBinary(const std::string& path) void Reconstruction::WriteImagesBinary(const std::string& path)

limap.pointsfm.read_write_model.read_images_text(path)
see: src/base/reconstruction.cc

void Reconstruction::ReadImagesText(const std::string& path) void Reconstruction::WriteImagesText(const std::string& path)

limap.pointsfm.read_write_model.read_model(path, ext='')
limap.pointsfm.read_write_model.read_next_bytes(fid, num_bytes, format_char_sequence, endian_character='<')

Read and unpack the next bytes from a binary file. :param fid: :param num_bytes: Sum of combination of {2, 4, 8}, e.g. 2, 6, 16, 30, etc. :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. :param endian_character: Any of {@, =, <, >, !} :return: Tuple of read and unpacked values.

limap.pointsfm.read_write_model.read_points3D_binary(path_to_model_file)
see: src/base/reconstruction.cc

void Reconstruction::ReadPoints3DBinary(const std::string& path) void Reconstruction::WritePoints3DBinary(const std::string& path)

limap.pointsfm.read_write_model.read_points3D_text(path)
see: src/base/reconstruction.cc

void Reconstruction::ReadPoints3DText(const std::string& path) void Reconstruction::WritePoints3DText(const std::string& path)

limap.pointsfm.read_write_model.rotmat2qvec(R)
limap.pointsfm.read_write_model.write_cameras_binary(cameras, path_to_model_file)
see: src/base/reconstruction.cc

void Reconstruction::WriteCamerasBinary(const std::string& path) void Reconstruction::ReadCamerasBinary(const std::string& path)

limap.pointsfm.read_write_model.write_cameras_text(cameras, path)
see: src/base/reconstruction.cc

void Reconstruction::WriteCamerasText(const std::string& path) void Reconstruction::ReadCamerasText(const std::string& path)

limap.pointsfm.read_write_model.write_images_binary(images, path_to_model_file)
see: src/base/reconstruction.cc

void Reconstruction::ReadImagesBinary(const std::string& path) void Reconstruction::WriteImagesBinary(const std::string& path)

limap.pointsfm.read_write_model.write_images_text(images, path)
see: src/base/reconstruction.cc

void Reconstruction::ReadImagesText(const std::string& path) void Reconstruction::WriteImagesText(const std::string& path)

limap.pointsfm.read_write_model.write_model(cameras, images, points3D, path, ext='.bin')
limap.pointsfm.read_write_model.write_next_bytes(fid, data, format_char_sequence, endian_character='<')

pack and write to a binary file. :param fid: :param data: data to send, if multiple elements are sent at the same time, they should be encapsuled either in a list or a tuple :param format_char_sequence: List of {c, e, f, d, h, H, i, I, l, L, q, Q}. should be the same length as the data list or tuple :param endian_character: Any of {@, =, <, >, !}

limap.pointsfm.read_write_model.write_points3D_binary(points3D, path_to_model_file)
see: src/base/reconstruction.cc

void Reconstruction::ReadPoints3DBinary(const std::string& path) void Reconstruction::WritePoints3DBinary(const std::string& path)

limap.pointsfm.read_write_model.write_points3D_text(points3D, path)
see: src/base/reconstruction.cc

void Reconstruction::ReadPoints3DText(const std::string& path) void Reconstruction::WritePoints3DText(const std::string& path)

limap.pointsfm.visualsfm_reader module

limap.pointsfm.visualsfm_reader.ReadModelVisualSfM(vsfm_path, nvm_file='reconstruction.nvm')

Module contents