Add some documentation

This commit is contained in:
Stefal 2023-09-20 22:10:06 +02:00
parent 05f6ff2acf
commit 744212971d
5 changed files with 23 additions and 0 deletions

View File

@ -29,3 +29,21 @@ optional arguments:
How many images you want to download How many images you want to download
--overwrite overwrite existing images --overwrite overwrite existing images
``` ```
## How to get my access token
- Go to https://www.mapillary.com/dashboard/developers
- Click on "Registrer Application", enter the needed informations, enable the application to "Read" data, then click on register :
![register application](./doc/snapshot_mapillary_register_application.jpg)
- When this registration is done, click on "view" in the token column. This is you access token :
![token](./doc/snapshot_mapillary_token.jpg)
## How to get my sequence id
- Go to https://mapillary.com/app
- Click on one of the picture of the sequence you want to download
- Click on the "image option" button (right panel)
- Click on "advanced" then click on the sequence id to copy it in the clipboard
![snapshot](./doc/snapshot_mapillary_sequence.jpg)

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -40,12 +40,14 @@ def download(url, filepath, metadata=None):
f.write(image) f.write(image)
print("{} downloaded".format(filepath)) print("{} downloaded".format(filepath))
def get_single_image_data(image_id, mly_header): 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) 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) r = session.get(req_url, headers=mly_header)
data = r.json() data = r.json()
return data return data
def get_image_data_from_sequences(sequences_id, mly_header): def get_image_data_from_sequences(sequences_id, mly_header):
for i,sequence_id in enumerate(sequences_id): for i,sequence_id in enumerate(sequences_id):
url = 'https://graph.mapillary.com/image_ids?sequence_id={}'.format(sequence_id) url = 'https://graph.mapillary.com/image_ids?sequence_id={}'.format(sequence_id)
@ -61,6 +63,7 @@ def get_image_data_from_sequences(sequences_id, mly_header):
image_data['sequence_id'] = sequence_id image_data['sequence_id'] = sequence_id
yield image_data yield image_data
def get_image_data_from_sequences__future(sequences_id, mly_header): def get_image_data_from_sequences__future(sequences_id, mly_header):
for i,sequence_id in enumerate(sequences_id): for i,sequence_id in enumerate(sequences_id):
url = 'https://graph.mapillary.com/image_ids?sequence_id={}'.format(sequence_id) url = 'https://graph.mapillary.com/image_ids?sequence_id={}'.format(sequence_id)
@ -86,6 +89,7 @@ def get_image_data_from_sequences__future(sequences_id, mly_header):
#print(image_data) #print(image_data)
yield image_data yield image_data
def write_exif(picture, img_metadata): def write_exif(picture, img_metadata):
''' '''
Write exif metadata Write exif metadata
@ -103,6 +107,7 @@ def write_exif(picture, img_metadata):
return updated_image return updated_image
if __name__ == '__main__': if __name__ == '__main__':
args = parse_args() args = parse_args()