from props import getNode from lib import pose from lib import project d2r = math.pi / 180.0 r2d = 180.0 / math.pi parser = argparse.ArgumentParser( description='Create a pix4d.csv file for a folder of geotagged images.') parser.add_argument('project', help='project directory') parser.add_argument( '--force-altitude', type=float, help='Fudge altitude geotag for stupid dji phantom 4 pro v2.0') parser.add_argument('--force-heading', type=float, help='Force heading for every image') parser.add_argument('--yaw-from-groundtrack', action='store_true', help='estimate yaw angle from ground track') args = parser.parse_args() image_dir = args.project proj = project.ProjectMgr(args.project) pose.make_pix4d(image_dir, args.force_altitude, args.force_heading, args.yaw_from_groundtrack)
############################################################################ log("Step 2: configure camera poses and per-image meta data files", fancy=True) ############################################################################ log("Configuring images") # create pose file (if it doesn't already exist, for example sentera # cameras will generate the pix4d.csv file automatically, dji does not) pix4d_file = os.path.join(args.project, 'pix4d.csv') meta_file = os.path.join(args.project, 'image-metadata.txt') if os.path.exists(pix4d_file): log("Found a pose file:", pix4d_file) elif os.path.exists(meta_file): log("Found a pose file:", meta_file) else: pose.make_pix4d(args.project, args.force_altitude) pix4d_file = os.path.join(args.project, 'pix4d.csv') meta_file = os.path.join(args.project, 'image-metadata.txt') if os.path.exists(pix4d_file): pose.set_aircraft_poses(proj, pix4d_file, order='rpy', max_angle=args.max_angle) elif os.path.exists(meta_file): pose.set_aircraft_poses(proj, meta_file, order='ypr', max_angle=args.max_angle) else: log("Error: no pose file found in image directory:", args.project)