def preprocesssift(dbname, imagetype): for path in glob.glob(dbname + '/*.' + imagetype): height, width = Image.open(path).size client.preprocess_image(path, path[:-4] + '.pgm', width, height) for path in glob.glob(dbname + '/*.pgm'): client.extract_features(path)
def preprocesssift(dbname, imagetype): for path in glob.glob(dbname +'/*.'+ imagetype): height,width = Image.open(path).size client.preprocess_image(path, path[:-4] + '.pgm', width, height) for path in glob.glob(dbname +'/*.pgm'): client.extract_features(path)
def siftprepsingle(path): height, width = Image.open(path).size client.preprocess_image(path, path[:-4] + '.pgm', width, height) client.extract_features(path[:-4] + '.pgm')
def siftprepsingle(path): height,width = Image.open(path).size client.preprocess_image(path, path[:-4] + '.pgm', width, height) client.extract_features(path[:-4] + '.pgm')
os.mkdir(p) return p # utilities for extracting features from the query image import client # framework for running queries import system # This is the query image image = 'tutorial/example_query_images/query1.png' # We need to extract features from the incoming query image client.preprocess_image(image, image[:-4] + '.pgm', width=200, height=200) client.extract_features(image[:-4] + '.pgm') # Construct a context C = TestContext() C.check() # Construct query object Q = _Query() Q.jpgpath = image Q.siftpath = os.path.splitext(image)[0] + "sift.txt" Q.setSensorCoord(37.875507, -122.264883) Q.check() # Tell the system to match this query Q in the context C stats, matchedimg, matches, ranked = system.match(C, Q)
@property def dbdump(self): return 'testdb' @property def dbdir(self): return 'testdb/cells-236.6' @property def matchdir(self): p = 'test_matches' if not os.path.exists(p): os.mkdir(p) return p image = 'tutorial/example_query_images/query1.png' client.preprocess_image(image, image[:-4] + '.pgm', width=200, height=200) client.extract_features(image[:-4] + '.pgm') C = TestContext() C.check() Q = _Query() Q.jpgpath = image Q.siftpath = os.path.splitext(image)[0] + "sift.txt" Q.setSensorCoord(37.875507, -122.264883) Q.check() stats, matchedimg, matches, ranked = system.match(C, Q) print "Matched db image ", matchedimg print "Visualization in ", C.resultsdir