Skip to content

Bug: pycolmap.qvec_to_rotmat and Image.qvec not found #2

@tigeryst

Description

@tigeryst

Description

When running scripts/preprocessing/extract_mesh_depth.py using the provided command in the README.md, I encountered the following error

AttributeError: module 'pycolmap' has no attribute 'qvec_to_rotmat'

Steps to reproduce

python scripts/preprocessing/extract_mesh_depth.py --vid=P06_01 --root=<your_storage_root>

What I expected

Installing pycolmap==3.11.1 (as listed in requirements.txt) should provide the functions/attributes used in the repository scripts.

What happened

  • pycolmap.qvec_to_rotmat() does not exist in pycolmap==3.11.1 nor in the latest release.
  • Similarly, images[idx].qvec assumes a qvec attribute exists on pycolmap.Image, which it does not (verified via dir(images[idx])).

Debugging details

I traced the error back to the function rasterize_mesh_with_pyrender() inside scripts/preprocessing/align_depth.py. The line with the issue is:

R = np.asmatrix(pycolmap.qvec_to_rotmat(images[idx].qvec)).transpose()
  • I checked the pycolmap version with pycolmap.__version__
  • I listed the attributes of pycolmap to confirm qvec_to_rotmat() indeed is not present using dir(pycolmap)
  • I listed the attributes of images[idx] to show that qvec also is not present using dir(images[idx])

Full error message

>> python scripts/preprocessing/extract_mesh_depth.py --vid=P06_01 --root=<my_storage_root_redacted_for_privacy>
Processing P06_01 ...
Saving files ...
  0%|                                                         | 0/298 [00:00<?, ?it/s]
========== My debugging start ==========
pycolmap.__version__='3.11.1'

Attributes of pycolmap using dir(pycolmap):
['', 'AbsolutePoseEstimationOptions', 'AbsolutePoseRefinementOptions', 'BACovariance', 'BACovarianceOptions', 'BACovarianceOptionsParams', 'BundleAdjuster', 'BundleAdjustmentConfig', 'BundleAdjustmentOptions', 'COLMAP_build', 'COLMAP_version', 'Camera', 'CameraMode', 'CameraModelId', 'CopyType', 'Correspondence', 'CorrespondenceGraph', 'Database', 'DatabaseCache', 'DatabaseTransaction', 'DelaunayMeshingOptions', 'Device', 'EstimateTriangulationOptions', 'ExhaustiveMatchingOptions', 'ExhaustivePairGenerator', 'ExperimentalPoseParam', 'Image', 'ImageAlignmentError', 'ImagePairStat', 'ImagePairsMatchingOptions', 'ImageReaderOptions', 'ImageSelectionMethod', 'ImportedPairGenerator', 'IncrementalMapper', 'IncrementalMapperCallback', 'IncrementalMapperOptions', 'IncrementalMapperStatus', 'IncrementalPipeline', 'IncrementalPipelineOptions', 'IncrementalTriangulator', 'IncrementalTriangulatorOptions', 'ItemsView', 'KeysView', 'ListPoint2D', 'LocalBundleAdjustmentReport', 'LossFunctionType', 'MapCameraIdToCamera', 'MapImageIdToImage', 'MapPoint3DIdToPoint3D', 'Normalization', 'ObservationManager', 'PairGenerator', 'Point2D', 'Point3D', 'PoissonMeshingOptions', 'PosePrior', 'PosePriorBundleAdjustmentOptions', 'PosePriorCoordinateSystem', 'RANSACOptions', 'Reconstruction', 'ReconstructionManager', 'Rigid3d', 'Rotation3d', 'SequentialMatchingOptions', 'SequentialPairGenerator', 'Sift', 'SiftExtractionOptions', 'SiftMatchingOptions', 'Sim3d', 'SpatialMatchingOptions', 'SpatialPairGenerator', 'StereoFusionOptions', 'SyntheticDatasetMatchConfig', 'SyntheticDatasetOptions', 'TYPE_CHECKING', 'Timer', 'Track', 'TrackElement', 'TriangulationResidualType', 'TwoViewGeometry', 'TwoViewGeometryConfiguration', 'TwoViewGeometryOptions', 'UndistortCameraOptions', 'ValuesView', 'VocabTreeMatchingOptions', 'VocabTreePairGenerator', '__all__', '__builtins__', '__cached__', '__ceres_version__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_core', 'align_reconstruction_to_locations', 'align_reconstructions_via_points', 'align_reconstructions_via_proj_centers', 'align_reconstructions_via_reprojections', 'bundle_adjustment', 'compare_reconstructions', 'compute_squared_sampson_error', 'create_default_bundle_adjuster', 'create_pose_prior_bundle_adjuster', 'essential_matrix_from_pose', 'estimate_absolute_pose', 'estimate_and_refine_absolute_pose', 'estimate_and_refine_generalized_absolute_pose', 'estimate_ba_covariance', 'estimate_calibrated_two_view_geometry', 'estimate_essential_matrix', 'estimate_fundamental_matrix', 'estimate_homography_matrix', 'estimate_sim3d', 'estimate_sim3d_robust', 'estimate_triangulation', 'estimate_two_view_geometry', 'estimate_two_view_geometry_pose', 'extract_features', 'has_cuda', 'import_images', 'import_module_symbols', 'incremental_mapping', 'infer_camera_from_image', 'logging', 'match_exhaustive', 'match_sequential', 'match_spatial', 'match_vocabtree', 'ostream', 'poisson_meshing', 'pose_from_homography_matrix', 'pyceres', 'refine_absolute_pose', 'set_random_seed', 'stereo_fusion', 'synthesize_dataset', 'textwrap', 'triangulate_points', 'undistort_images', 'utils', 'verify_matches']

images[idx]:
Image(image_id=1, camera=Camera(camera_id=1), name="frame_0000000001.jpg", has_pose=1, triangulated=161/512)

Attributes of images[idx] using dir(images[idx]):
['__class__', '__copy__', '__deepcopy__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '_pybind11_conduit_v1_', 'cam_from_world', 'camera', 'camera_id', 'get_observation_point2D_idxs', 'get_observation_points2D', 'has_camera_id', 'has_camera_ptr', 'has_point3D', 'has_pose', 'image_id', 'mergedict', 'name', 'num_points2D', 'num_points3D', 'point2D', 'points2D', 'project_point', 'projection_center', 'reset_camera_ptr', 'reset_point3D_for_point2D', 'reset_pose', 'set_point3D_for_point2D', 'summary', 'todict', 'viewing_direction']
========== My debugging end ==========
  0%|                                                         | 0/298 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "~/egoseg3d/scripts/preprocessing/extract_mesh_depth.py", line 80, in <module>
    run(args)
  File "~/egoseg3d/scripts/preprocessing/extract_mesh_depth.py", line 70, in run
    mesh_depth = align_depth.rasterize_mesh_with_pyrender(
  File "~/egoseg3d/scripts/preprocessing/align_depth.py", line 92, in rasterize_mesh_with_pyrender
    R = np.asmatrix(pycolmap.qvec_to_rotmat(images[idx].qvec)).transpose()
AttributeError: module 'pycolmap' has no attribute 'qvec_to_rotmat'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions