Switch branches/tags
Nothing to show
Find file History
Permalink
..
Failed to load latest commit information.
lib fix(exifedit): Add image description edits Oct 1, 2017
LICENSE.md Add LICENSE (MIT) Aug 5, 2014
README.md Merge pull request #172 from richlv/patch-1 Sep 5, 2017
__init__.py cleaning up, moving the one-sequence-per-subfolder functionality into… Sep 15, 2015
add_fix_dates.py feat(pexif): Replace pyexiv2 with pexif Jul 20, 2017
add_mapillary_tag_from_exif.py fix(exifedit): Add missing params Jul 31, 2017
add_mapillary_tag_from_json.py feat(json): Add counts to log Oct 1, 2017
add_project.py fix(uploader): Use api v2 Sep 7, 2017
download_images.py Update download_images.py Sep 7, 2017
export_panoramio.py fix(exifedit): Add missing params Jul 31, 2017
geotag_from_gpx.py typo Aug 12, 2017
geotag_video.py feat(video): Add make/model and gps start time Sep 26, 2017
interpolate_direction.py feat(pexif): Replace pyexiv2 with pexif Jul 20, 2017
interpolate_with_anchors.py Make scripts executable May 23, 2017
json_to_gpx.py Make scripts executable May 23, 2017
remove_duplicates.py changed shebang to /usr/bin/env May 23, 2017
requirements.txt feat(requirement): Freeze lib version Jul 27, 2017
sequence_split.py Make scripts executable May 23, 2017
update_tags.py feat(pexif): Replace pyexiv2 with pexif Jul 20, 2017
upload.py changed shebang to /usr/bin/env May 23, 2017
upload_video_with_preprocessing.py Make scripts executable May 23, 2017
upload_with_authentication.py changed shebang to /usr/bin/env May 23, 2017
upload_with_preprocessing.py fix(upload): Remove project key fetching Sep 22, 2017

README.md

Python Tools for Mapillary

Dependencies

Installing on MacOSX

sudo pip install -r requirements.txt

If you don't have pip on your system, you can install it by sudo easy_install pip.

Installing on Ubuntu

sudo apt install python python-virtualenv python-dev python-pyexiv2
python -m virtualenv --python=python2 --system-site-packages .env
source .env/bin/activate
pip install -r requirements.txt

Run deactivate to exit the virtualenv.

Preprocessing

Use these scripts to process your photos before uploading to improve the upload quality.

add_fix_dates.py

Script for adding dates to jpg files extracted from video with no tags. if you have a directory of files provide the directory, the datetime for the first file, and an increment in seconds. For example, if the photos are taken every 2 seconds, you can use

python add_fix_dates.py path-to-images/ '2014-11-27 13:01:01' 2

add_mapillary_tag_from_exif.py

Script for uploading images taken with other cameras than the Mapillary iOS or Android apps. Adds Mapillary data to EXIF tag to enable image to be handled in the same way as Mapillary native images.

python add_mapillary_tag_from_exif path-to-images/ [sequence_id]

(Requires environment variables set: MAPILLARY_USERNAME, MAPILLARY_EMAIL or MAPILLARY_PASSWORD)

add_project.py

Writes the project tokens to the EXIF of images in the given path. This way, you can add photos to a project programmatically. Use like this:

python add_project.py path-to-images/ project_name

(Requires enviroment variables set: MAPILLARY_USERNAME, MAPILLARY_PASSWORD)

geotag_from_gpx.py

A lightweight script for geotagging images with GPS data from a gpx file. Writes lat, lon, and bearing to the right EXIF tags. Use it like:

python geotag_from_gpx.py path-to-images/ gpx_file --time-offset [time_offset]

The time_offset is optional and is used if your camera clock is offset from your GPS clock. (Requires gpxpy, e.g. 'pip install gpxpy').

interpolate_direction.py

Interpolates the direction of an image based on the coordinates stored in the EXIF tag of the next image in a set of consecutive images.

python interpolate_direction.py path-to-images/ --offset_angle [offset_angle]

remove_duplicates.py

Supports the work flow of an action camera, by moving images taken too close together into another folder. This is for example when waiting for a green light. Images with bad or unrealistic exif data is moved to an error folder. Run using:

python remove_duplicates.py [-d min-distance-meters] src-path/ [duplicate-path/]

Run with -h to see all options. Requires either the PIL or Pillow package to be installed. Pillow is newest and is the only one which will be supported in the future. Install using pip install Pillow or see http://pillow.readthedocs.org/.

sequence_split.py

This script organizes images into sequence groups based on a cutoff distance (in meters) and a cutoff time (in seconds). This is useful as a step before uploading lots of photos with the manual uploader. For example:

python sequence_split.py path-to-images/ cutoff_distance [cutoff_time]

If no cutoff time is given, it will be estimated based on the between-photo differences.

Upload

Use the upload script that suits your photos best.

upload.py

This script uploads images taken with any of the Mapillary apps to the Mapillary backend. EXIF tags must be added to the images before copying them to the computer. Just run:

python upload.py path-to-images/

To upload multiple sequences at once use the following syntax with the additional arguement:

python upload.py path-to-images/ --upload_subfolders

Upload images from the current directory, including subdirectories:

python upload.py --upload_subfolders .

By default, 4 threads upload in parallel and the script retries 10 times upon encountering a failure. These can be customised with environment variables like so:

NUMBER_THREADS=2 MAX_ATTEMPTS=100 python upload.py path-to-images/

On Android Systems you can find the images under /storage/emulated/0/Android/data/app.mapillary/files/pictures/.

On iOS, open iTunes, select your device, and scroll down to Mapillary under apps. You can see the files and copy them over from there.

upload_with_authentication.py

Script for uploading images taken with other cameras than the Mapillary apps. You can upload as:

python upload_with_authentication.py path-to-images/

See this blog post for more details.

If upload fails mid-sequence due to connection failure or similar, you should manually push the images to the server by opening Manual Uploads and pressing "push to Mapillary".

(Requires environment variables set: MAPILLARY_USERNAME, MAPILLARY_PERMISSION_HASH, MAPILLARY_SIGNATURE_HASH from upload from script information)

upload_with_preprocessing.py

Script for preprocessing and uploading images taken with other cameras than the Mapillary iOS or Android apps.

python upload_with_preprocessing.py path-to-images/

It runs in the following steps:

  • Skip images that are potential duplicates (optional with --remove_duplicates)
  • Group images into sequences based on gps and time
  • Interpolate compass angles for each sequence
  • Add Mapillary tags to the images
  • Upload the images

(Requires environment variables set: MAPILLARY_USERNAME, MAPILLARY_PERMISSION_HASH, MAPILLARY_SIGNATURE_HASH from upload from script information)

Download

Download images from Mapillary.

download_images.py

Script to download images using the Mapillary image search API. Downloads images inside a rect (min_lat, max_lat, min_lon, max_lon).

download_images.py min_lat max_lat min_lon max_lon [--max_results=(max_results)] [--image_size=(320, 640, 1024, or 2048)]