fix metadata when camera_type is equirectangular

This commit is contained in:
Stefal 2023-10-14 13:19:50 +02:00
parent b410c1704d
commit 59933a7310
1 changed files with 4 additions and 2 deletions

View File

@ -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)