def countimgsinrange(querydir="E:\query3", celldir="E:\Research\cellsg=100,r=d=236.6"): names = set() jpgs = getJPGFileNames(querydir) counts=[] for img in jpgs: lat, lon = info.getQueryCoord(img) cell, dist=getclosestcell(lat, lon, celldir) count = getNumJPGInRange(lat, lon, os.path.join(celldir, cell), 100) print "{0}: {1}".format(img, count) counts.append(count) print sum(counts)/len(counts)
def copyclosest(querydir="E:/Research/collected_images/query/query1/", inputDir="E:/Research/collected_images/earthmine-new,culled/37.871955,-122.270829/", outputDir="E:/Research/query1closest-r80", radius=80): queryfiles = getJPGFileNames(querydir) if os.path.exists(outputDir): shutil.rmtree(outputDir) os.makedirs(outputDir) for queryfile in queryfiles: outdir = os.path.join(outputDir, queryfile) os.makedirs(outdir) lat, lon = info.getQueryCoord(queryfile) print lat, lon copyJPGInRange(lat, lon, inputDir, outdir, radius)