Last active
December 20, 2015 06:19
-
-
Save dbuscombe-usgs/6085352 to your computer and use it in GitHub Desktop.
Auto-Classify images, part 1. First, import the libraries you'll need. Then interrogates the website and downloads the images.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: import simplejson as json | |
except ImportError: import json | |
import os | |
import urllib, urlparse | |
import glob | |
import numpy as np | |
import Image | |
from itertools import combinations | |
import simplejson as json | |
import pylab as mpl | |
c = urllib.urlopen(url) | |
j =json.loads(c.read()) | |
imurls=[] | |
for im in j['photos']: | |
imurls.append(im['photo_file_url']) | |
for url in imurls: | |
image = urllib.URLopener() | |
image.retrieve(url,os.path.basename(urlparse.urlparse(url).path)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment