if __name__ == "__main__": argParser = argparse.ArgumentParser(description="Calibrate, register, and stack astrophotography images") argParser.add_argument("images", nargs='+', metavar="image", help="Input images to stack") argParser.add_argument("--reference", nargs='?', metavar="image", help="Reference image (not included in stack)") argParser.add_argument("--out", nargs='?', metavar="filename", help="Output file (mean)") argParser.add_argument("--outstdev", nargs='?', metavar="filename", help="Output file (stdev)") argParser.add_argument("--dump_dir", nargs='?', metavar="directory", help="Output directory for image dumps") argParser.add_argument("--dump_format", nargs='?', metavar="extension", help="Output format for image dumps") argParser.add_argument("--dump_stars", action="store_true", help="Dump found stars to an image") argParser.add_argument("--dump_flat", action="store_true", help="Dump flattened image (which is what the star finder uses)") argSuccess = True try: args = argParser.parse_args() except (Exception, SystemExit): argSuccess = False if argSuccess: ImageIo.initConfig(args.dump_dir, args.dump_format) Register.initConfig(args.dump_stars, args.dump_flat) list = ImageIo.loadImageGlob(args.images) reference = None if args.reference is not None: reference = ImageIo.loadImage(args.reference) reg = Register.register(reference, list) stack, stackDev = Stack.stack(reg) if args.out is not None: ImageIo.saveImage(stack, args.out) if args.outstdev is not None: ImageIo.saveImage(stackDev, args.outstdev)