def write_colmap_model(odp, cameras, points, op=None):
        """Write cameras and points as :code:`Colmap` model."""
        log_report("INFO", "Write Colmap model folder: " + odp, op)

        if not os.path.isdir(odp):
            os.mkdir(odp)

        # From photogrammetry_importer\ext\read_write_model.py
        #   CameraModel = collections.namedtuple(
        #       "CameraModel", ["model_id", "model_name", "num_params"])
        #   Camera = collections.namedtuple(
        #       "Camera", ["id", "model", "width", "height", "params"])
        #   BaseImage = collections.namedtuple(
        #       "Image", ["id", "qvec", "tvec", "camera_id", "name", "xys", "point3D_ids"])
        #   Point3D = collections.namedtuple(
        #       "Point3D", ["id", "xyz", "rgb", "error", "image_ids", "point2D_idxs"])

        colmap_cams = {}
        colmap_images = {}
        for cam in cameras:
            # TODO Support the "PINHOLE" camera model
            colmap_camera_model_name = "SIMPLE_PINHOLE"

            pp = cam.get_principal_point()
            colmap_cam = ColmapCamera(
                id=cam.id,
                model=colmap_camera_model_name,
                width=cam.width,
                height=cam.height,
                params=np.array([cam.get_focal_length(), pp[0], pp[1]]),
            )
            colmap_cams[cam.id] = colmap_cam
            
            image_filename = cam.get_file_name()
            if (re.findall(r"\.\d\d\d$", image_filename)):
                image_filename = image_filename[:-4]
                
            colmap_image = ColmapImage(
                id=cam.id,
                qvec=cam.get_rotation_as_quaternion(),
                tvec=cam.get_translation_vec(),
                camera_id=cam.id,
                name=image_filename,
                xys=[],
                point3D_ids=[],
            )
            colmap_images[cam.id] = colmap_image

        colmap_points3D = {}
        for point in points:
            colmap_point = ColmapPoint3D(
                id=point.id,
                xyz=point.coord,
                rgb=point.color,
                error=0,
                # The default settings in Colmap show only points with more than
                # 3 observations
                image_ids=[0, 1, 2],
                point2D_idxs=[0, 1, 2],
            )
            colmap_points3D[point.id] = colmap_point

        write_model(
            colmap_cams, colmap_images, colmap_points3D, odp, ext=".txt"
        )
Write cameras and points as :code:`Colmap` model.
photogrammetry_importer/file_handlers/colmap_file_handler.py