def rectangle(fname): img = bnw(fname) img = img[22:, 22:] params = locate(fname) Ri = params[0] # Inner (pupil) radius Ro = params[1] # Outer (iris) radius y, x = params[2] # center coordinates x -= 10 y -= 10 H = int(Ro - Ri) W = 360 newmap = zeros([H, W]) for r in range(H): for c in range(W): mapped_point_col = int(x + (Ri + r) * cos(radians(c))) mapped_point_row = int(y + (Ri + r) * sin(radians(c))) dot = img[min([img.shape[0] - 1, mapped_point_row]), min([img.shape[1], mapped_point_col])] newmap[r, c] = dot #print('Center: ( ' + str(x) + ' , ' + str(y) + ' )') #disp(newmap) return newmap[5:44, :]
def rectangle(fname): ''' Returns a rectangular image corresponding to the iris using locate.py Parameters ---------- fname: string The name of the image in string format. Returns ------- newmap: A rectangular in the circular iris is converted to a rectangular slot. ''' img = bnw(fname) img = img[22:, 22:] #disp(img) params = locate(fname) Ri = params[0] # Inner (pupil) radius Ro = params[1] # Outer (iris) radius y, x = params[2] # center coordinates x -= 10 y -= 10 H = int(Ro - Ri) W = 360 newmap = zeros([H, W]) for r in range(H): for c in range(W): mapped_point_col = int(x + (Ri + r) * cos(radians(c))) mapped_point_row = int(y + (Ri + r) * sin(radians(c))) dot = img[min([img.shape[0] - 1, mapped_point_row]), min([img.shape[1], mapped_point_col])] newmap[r, c] = dot print('Center: ( ' + str(x) + ' , ' + str(y) + ' )') #disp(newmap) return newmap #rectangle("left.bmp")
def run(data_path): articles = glob.glob(os.path.join(data_path, '*')) nb_articles = len(articles) count = 0 for article in articles: print "------------------ %s/%s ------------------" % (count, nb_articles) pmid = article.split('/')[-1] article_text = open(article, 'r').read() print "-- %s -- " % pmid abstract = get_from_db2(pmid) if abstract: (span_id, span_text) = locate(abstract, article_text, pmid) if span_id: print "%s\t%s\t%s" % (pmid, span_id, 'abstract2') print "-------------- db2_abstract --------------" print abstract print "-------------- span_abstract -------------" print span_text print "----------------- span_id ----------------" print span_id count +=1
#!/usr/bin/python2.7 # # Compile all resources from sourcetree using Sipred configuration # $ rcc -binary -no-compress <resourcefile.qrc> -o <resourcefile.rcc> # import inspect from subprocess import call from locate import * for qrc in locate('*.qrc'): print 'Compiling resource file at:' print qrc rcc = qrc.replace('.qrc', '.rcc') call(['rcc', '-binary', '-no-compress', qrc , '-o', rcc]) for rcc in locate('*.rcc'): print 'Moving resource file to Sipred-Release/share' call(['mv', rcc, '../Sipred-Release/share'])
#price of clothes if 'polo' in inp: Tsh.polo() elif 'short sleeve' in inp: sh.short() elif 'long sleeve' in inp: sh.long() engine.say("Hi, I am the mall robot. Do you want to buy something") engine.runAndWait() y = input() while y == "yes": locate() break engine.say("Will you like to know the price of the item you want to purchase") engine.runAndWait() b = input() while b == "yes": price() break while b == 'yes': engine.say("Do you want to buy something else") engine.runAndWait() c = input() while c == 'yes':
def test_search_cwd(self): hits = locate("testfile.txt", "./test/") assert hits[:1] == ["./test/lvl2/testfile.txt"]