def main(args): if args.output_directory: directory = args.output_directory else: directory = os.path.dirname(args.input_image) print "No output directory specified. Defaulting to %s"%directory if not os.path.exists(directory): os.makedirs(directory) if args.output_prefix: prefix = args.output_prefix else: prefix = os.path.splitext(os.path.basename(args.input_image))[0] print "No output prefix selected. Defaulting to %s"%prefix output_file = "%s/%s.pts"%(directory, prefix) if not args.input_points_file: args.input_points_file = output_file if not args.force_overwrite and os.path.exists( args.input_points_file ): point_set_old = PointSet( ) point_set_old.read_from_file( args.input_points_file ) for pt in point_set_old.get_points(): points.append( pt ) image = cv.LoadImage( args.input_image) window = PointWindow( image, args.zoom_out) if save_flag: point_set = PointSet() for pt in points: point_set.add_point( pt ) point_set.save_to_file( output_file ) print "Saved to %s"%output_file
def main(args): if args.output_directory: directory = args.output_directory else: directory = os.path.dirname(args.input_image) print "No output directory specified. Defaulting to %s" % directory if not os.path.exists(directory): os.makedirs(directory) if args.output_prefix: prefix = args.output_prefix else: prefix = os.path.splitext(os.path.basename(args.input_image))[0] print "No output prefix selected. Defaulting to %s" % prefix output_file = "%s/%s.pts" % (directory, prefix) if not args.input_points_file: args.input_points_file = output_file if not args.force_overwrite and os.path.exists(args.input_points_file): point_set_old = PointSet() point_set_old.read_from_file(args.input_points_file) for pt in point_set_old.get_points(): points.append(pt) image = cv.LoadImage(args.input_image) window = PointWindow(image, args.zoom_out) if save_flag: point_set = PointSet() for pt in points: point_set.add_point(pt) point_set.save_to_file(output_file) print "Saved to %s" % output_file
def main(args): match_set = MatchSet( "foo", "bar" ) print "Reading from " + args.match match_set.read_from_file( args.match ) compare_set = PointSet( ) ref_set = PointSet( ) if not args.ref_file: args.ref_file = os.path.basename(args.match).split('_TO_')[1].split('.matches')[0]+".pts" if not args.comp_file: args.comp_file = os.path.basename(args.match).split('_TO_')[0]+".pts" for match in match_set.get_matches(): compare_set.add_point(match.compare_pt) ref_set.add_point(match.reference_pt) ##if not os.path.exists(os.path.dirname( args.ref_file ) ): ## os.makedirs(os.path.dirname( args.ref_file ) ) ##if not os.path.exists(os.path.dirname( args.comp_file ) ): ## os.makedirs(os.path.dirname( args.comp_file ) ) ref_set.save_to_file( args.ref_file ) compare_set.save_to_file( args.comp_file )