<s> from PIL import Image <EOL> import os <EOL> from numpy import * <EOL> import sift <EOL> def process_image_dsift ( imagename , resultname , size = <NUM_LIT:20> , steps = <NUM_LIT:10> , force_orientation = False , resize = None ) : <EOL> """<STR_LIT>""" <EOL> im = Image . open ( imagename ) . convert ( '<STR_LIT:L>' ) <EOL> if resize != None : <EOL> im = im . resize ( resize ) <EOL> m , n = im . size <EOL> if imagename [ - <NUM_LIT:3> : ] != '<STR_LIT>' : <EOL> im . save ( '<STR_LIT>' ) <EOL> imagename = '<STR_LIT>' <EOL> scale = size / <NUM_LIT> <EOL> x , y = meshgrid ( range ( steps , m , steps ) , range ( steps , n , steps ) ) <EOL> xx , yy = x . flatten ( ) , y . flatten ( ) <EOL> frame = array ( [ xx , yy , scale * ones ( xx . shape [ <NUM_LIT:0> ] ) , zeros ( xx . shape [ <NUM_LIT:0> ] ) ] ) <EOL> savetxt ( '<STR_LIT>' , frame . T , fmt = '<STR_LIT>' ) <EOL> if force_orientation : <EOL> cmmd = str ( "<STR_LIT>" + imagename + "<STR_LIT>" + resultname + <EOL> "<STR_LIT>" ) <EOL> else : <EOL> cmmd = str ( "<STR_LIT>" + imagename + "<STR_LIT>" + resultname + <EOL> "<STR_LIT>" ) <EOL> os . system ( cmmd ) <EOL> print '<STR_LIT>' , imagename , '<STR_LIT:to>' , resultname </s>
