in mapillary_tools/geotag/geotag_from_gopro.py [0:0]
def to_description(self) -> T.List[types.ImageDescriptionFileOrError]:
descs: T.List[types.ImageDescriptionFileOrError] = []
images = utils.get_image_file_list(self.image_dir)
for video in self.videos:
LOG.debug("Processing GoPro video: %s", video)
sample_images = utils.filter_video_samples(images, video)
LOG.debug(
"Found %d sample images from video %s",
len(sample_images),
video,
)
if not sample_images:
continue
points = get_points_from_gpmf(video)
# bypass empty points to raise MapillaryGPXEmptyError
if points and geotag_utils.is_video_stationary(
get_max_distance_from_start([(p.lat, p.lon) for p in points])
):
LOG.warning(
"Fail %d sample images due to stationary video %s",
len(sample_images),
video,
)
for image in sample_images:
err = types.describe_error(
exceptions.MapillaryStationaryVideoError(
"Stationary GoPro video"
)
)
descs.append({"error": err, "filename": image})
continue
with tqdm(
total=len(sample_images),
desc=f"Interpolating {os.path.basename(video)}",
unit="images",
disable=LOG.getEffectiveLevel() <= logging.DEBUG,
) as pbar:
geotag = GeotagFromGPXWithProgress(
self.image_dir,
sample_images,
points,
use_gpx_start_time=self.use_gpx_start_time,
offset_time=self.offset_time,
progress_bar=pbar,
)
descs.extend(geotag.to_description())
return descs