def vectorize(image, algo): fac = AlgorithmFactory() vec = fac.get(algo)() orbfile = path.join(path.dirname(image), path.splitext( path.basename(image))[0]+'.orb') with open(orbfile, "w") as output_file: writer = csv.writer(output_file) desc = vec.preprocess(image) if (vec.needs_bof): for feat in desc: writer.writerow(feat) print("Now processing with ruby...") os.system("ruby lib/histogram.rb '" + orbfile + "' orb") else: writer.writerow(desc)
def build_training_set(defname, algo): fac = AlgorithmFactory() builder = TrainingSetBuilder(defname, algo, fac.get(algo)()) builder.build_training_set()