From 59933a7310b5c3548166dee8e52affe3cc58414e Mon Sep 17 00:00:00 2001 From: Stefal Date: Sat, 14 Oct 2023 13:19:50 +0200 Subject: [PATCH] fix metadata when camera_type is equirectangular --- mapillary_download.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mapillary_download.py b/mapillary_download.py index 1d388a9..dbaaca1 100644 --- a/mapillary_download.py +++ b/mapillary_download.py @@ -26,7 +26,7 @@ def parse_args(argv =None): parser.add_argument('--destination', type=str, default='data', help='Path destination for the images') parser.add_argument('--image_limit', type=int, default=None, help='How many images you want to download') parser.add_argument('--overwrite', default=False, action='store_true', help='overwrite existing images') - parser.add_argument("-v", "--version", action="version", version="release 1.1") + parser.add_argument("-v", "--version", action="version", version="release 1.2") args = parser.parse_args(argv) if args.sequence_ids is None and args.image_ids is None: parser.error("Please enter at least one sequence id or image id") @@ -45,6 +45,7 @@ def get_single_image_data(image_id, mly_header): req_url = 'https://graph.mapillary.com/{}?fields=thumb_original_url,altitude,camera_type,captured_at,compass_angle,geometry,exif_orientation,sequence'.format(image_id) r = session.get(req_url, headers=mly_header) data = r.json() + #print(data) return data @@ -152,7 +153,7 @@ if __name__ == '__main__': capture_time = datetime.utcfromtimestamp(int(image_data['captured_at'])/1000), longitude = image_data['geometry']['coordinates'][0], latitude = image_data['geometry']['coordinates'][1], - picture_type = PictureType("equirectangular") if image_data['camera_type'] == 'spherical' else None, + picture_type = PictureType("equirectangular") if image_data['camera_type'] == 'spherical' or image_data['camera_type'] == 'equirectangular' else None, direction = image_data['compass_angle'], altitude = image_data['altitude'], ) @@ -161,3 +162,4 @@ if __name__ == '__main__': print("{} already exists. Skipping ".format(path)) continue executor.submit(download, url=image_data['thumb_original_url'], filepath=path, metadata=img_metadata) + #download(url=image_data['thumb_original_url'], filepath=path, metadata=img_metadata)