$search
00001 import os 00002 import os.path 00003 import getopt 00004 import sys 00005 00006 def filelist(thepath): 00007 ''' this python script read images from a directory, 00008 add perform text detection ''' 00009 dirlist = os.listdir(thepath) 00010 executeBin = "$(rospack find read_text)/bin/run_detect " 00011 correlation = "$(rospack find read_text)/fonts/correlation.txt" 00012 dictionary = "$(rospack find read_text)/dictionary/full-dictionary" 00013 print "current directory:" + thepath 00014 for name in dirlist: 00015 absolutePath = os.path.join(thepath,name) 00016 if not os.path.isdir(absolutePath): 00017 print name 00018 if name.endswith(".jpg") or name.endswith(".png") or name.endswith(".JPG"): 00019 execute = executeBin + absolutePath + correlation + dictionary 00020 os.system(execute) 00021 else: 00022 filelist(absolutePath) 00023 00024 if __name__ == "__main__": 00025 filelist(sys.argv[1]);