def extract_dir(inputdir, outputdir, options): if (inputdir[-1] == "/"): inputdir = inputdir[:-1] if (outputdir[-1] == "/"): outputdir = outputdir[:-1] ct = CurvePoint() sc = CntSC() das = CntDAS() agl = CntAngle() allfile = os.listdir(inputdir) to_file = options.ter start_file = options.start if (to_file == -1): to_file = len(allfile) if (to_file > len(allfile)): to_file = len(allfile) if (start_file < 0): start_file = 0 for i in range(start_file, to_file): f = allfile[i] inputfile = inputdir + "/"+ f outputfile = outputdir + "/" + f ct.LoadCont(inputfile) for c in ct.allselected: if (options.shapecontext): sc.ExtractFeature(c) if (options.angle): agl.ExtractFeature(c, 0) if (options.das): das.ExtractFeature(c, 0) ct.Save(outputfile)
def main(): ct = CurvePoint() sc = CntSC() usage = "%prog [options] <pointfile>" version = "%prog 0.2\nLongbin Chen, [email protected]" oparser = optparse.OptionParser(usage=usage, version=version) oparser.add_option('-o', '--output', dest='output', default=None, help='output file') (options, args) = oparser.parse_args(sys.argv) if len(args) != 2: oparser.parse_args([sys.argv[0], "--help"]) sys.exit(1) ct.LoadCont(args[1]) allkeys = [] for c in ct.allselected: allkeys = allkeys + c sc.ExtractFeature(allkeys) if (options.output): ct.Save(options.output)
def extract_file(input, output, options): ct = CurvePoint() sc = CntSC() das = CntDAS() agl = CntAngle() ct.LoadCont(input) for c in ct.allselected: if (options.shapecontext): sc.ExtractFeature(c) if (options.angle): agl.ExtractFeature(c, 0) if (options.das): das.ExtractFeature(c, 0) ct.Save(output)