Skip to content
This repository was archived by the owner on Jun 22, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
*~
*.pyc
**.vscode
**/aura-props
**/tmp
28 changes: 28 additions & 0 deletions cameras/DJI_FC330.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"K": [
3666.666504,
0.0,
2432.0,
0.0,
3666.666504,
1824.0,
0.0,
0.0,
1.0
],
"ccd_height_mm": 4.72,
"ccd_width_mm": 6.30,
"dist_coeffs": [
0.0,
0.0,
0.0,
0.0,
0.0
],
"focal_len_mm": 4,
"height_px": 3000,
"lens_model": "unknown",
"make": "DJI",
"model": "FC330",
"width_px": 4000
}
25 changes: 0 additions & 25 deletions scripts/1a-create-project.py

This file was deleted.

25 changes: 25 additions & 0 deletions scripts/1a_create_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/python3

import os, sys, argparse

from lib import ProjectMgr

# initialize a new project workspace
def new_project(project_dir):
# test if images directory exists
if not os.path.isdir(project_dir):
print("Images directory doesn't exist:", args.project)
quit()

# create an empty project
proj = ProjectMgr.ProjectMgr(project_dir, create=True)

# and save what we have so far ...
proj.save()

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Create an empty project.')
parser.add_argument('--project', required=True, help='Directory with a set of aerial images.')

args = parser.parse_args()
new_project(args.project)
72 changes: 0 additions & 72 deletions scripts/1b-set-camera-config.py

This file was deleted.

74 changes: 74 additions & 0 deletions scripts/1b_set_camera_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/python3

import argparse
import fnmatch
import os.path

# from the aura-props package
from props import getNode, PropertyNode
import props_json

from lib import ProjectMgr


def set_camera(project_dir, camera, yaw_deg = 0.0, pitch_deg = -90.0, roll_deg = 0.0):
proj = ProjectMgr.ProjectMgr(project_dir)

if camera:
# specified on command line
camera_file = camera
else:
# auto detect camera from image meta data
camera, make, model, lens_model = proj.detect_camera()
camera_file = os.path.join("..", "cameras", camera + ".json")
print("Camera:", camera_file)

# copy/overlay/update the specified camera config into the existing
# project configuration
cam_node = getNode('/config/camera', True)
tmp_node = PropertyNode()
if props_json.load(camera_file, tmp_node):
for child in tmp_node.getChildren(expand=False):
if tmp_node.isEnum(child):
# print(child, tmp_node.getLen(child))
for i in range(tmp_node.getLen(child)):
cam_node.setFloatEnum(child, i, tmp_node.getFloatEnum(child, i))
else:
# print(child, type(tmp_node.__dict__[child]))
child_type = type(tmp_node.__dict__[child])
if child_type is float:
cam_node.setFloat(child, tmp_node.getFloat(child))
elif child_type is int:
cam_node.setInt(child, tmp_node.getInt(child))
elif child_type is str:
cam_node.setString(child, tmp_node.getString(child))
else:
print('Unknown child type:', child, child_type)

proj.cam.set_mount_params(yaw_deg, pitch_deg, roll_deg)

# note: dist_coeffs = array[5] = k1, k2, p1, p2, k3

# ... and save
proj.save()
else:
# failed to load camera config file
if not camera:
print("Camera autodetection failed.")
print("Consider running the new camera script to create a camera config")
print("and then try running this script again.")
else:
print("Provided camera config not found:", camera)

if __name__ == "__main__":
# set all the various camera configuration parameters
parser = argparse.ArgumentParser(description='Set camera configuration.')
parser.add_argument('--project', required=True, help='project directory')
parser.add_argument('--camera', help='camera config file')
parser.add_argument('--yaw-deg', type=float, default=0.0,
help='camera yaw mounting offset from aircraft')
parser.add_argument('--pitch-deg', type=float, default=-90.0,
help='camera pitch mounting offset from aircraft')
parser.add_argument('--roll-deg', type=float, default=0.0,
help='camera roll mounting offset from aircraft')
args = parser.parse_args()
58 changes: 0 additions & 58 deletions scripts/2a-set-poses.py

This file was deleted.

59 changes: 59 additions & 0 deletions scripts/2a_set_poses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/python3

import argparse
import os

from props import getNode

from lib import Pose
from lib import ProjectMgr

# for all the images in the project image_dir, detect features using the
# specified method and parameters

def set_pose(project_dir, max_angle = 25.0 ):
proj = ProjectMgr.ProjectMgr(project_dir)
print("Loading image info...")
proj.load_images_info()

# simplifying assumption
image_dir = project_dir

pix4d_file = os.path.join(image_dir, 'pix4d.csv')
meta_file = os.path.join(image_dir, 'image-metadata.txt')
if os.path.exists(pix4d_file):
Pose.setAircraftPoses(proj, pix4d_file, order='rpy',
max_angle=max_angle)
elif os.path.exists(meta_file):
Pose.setAircraftPoses(proj, meta_file, order='ypr',
max_angle=max_angle)
else:
print("Error: no pose file found in image directory:", image_dir)
quit()

# compute the project's NED reference location (based on average of
# aircraft poses)
proj.compute_ned_reference_lla()
ned_node = getNode('/config/ned_reference', True)
print("NED reference location:")
ned_node.pretty_print(" ")

# set the camera poses (fixed offset from aircraft pose) Camera pose
# location is specfied in ned, so do this after computing the ned
# reference point for this project.
Pose.compute_camera_poses(proj)

# save the poses
proj.save_images_info()

# save change to ned reference
proj.save()

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Set the aircraft poses from flight data.')
parser.add_argument('--project', required=True, help='project directory')
#parser.add_argument('--meta', help='use the specified image-metadata.txt file (lat,lon,alt,yaw,pitch,roll)')
#parser.add_argument('--pix4d', help='use the specified pix4d csv file (lat,lon,alt,roll,pitch,yaw)')
parser.add_argument('--max-angle', type=float, default=25.0, help='max pitch or roll angle for image inclusion')

args = parser.parse_args()
File renamed without changes.
File renamed without changes.
Loading