예제 #1
0
    def loads(self, stream, fileroot):
        self.wipe_slate()

        design = PropertyNode()
        if props_json.loads(stream, design, ""):
            print "json parse successful"
        else:
            error = QErrorMessage(self)
            error.showMessage( "json parse failed" )
            return False
        # design.pretty_print()

        self.setWindowTitle( self.default_title + " - " + fileroot )

        node = design.getChild('overview', True)
        self.overview.load(node)

        design.setLen('wing', 1) # force to be enumerated if not already
        num_wings = design.getLen('wing')
        for i in range(num_wings):
            wing_node = design.getChild('wing[%d]' % i)
            wing = WingUI(changefunc=self.onChange)
            wing.load(wing_node)
            self.wings.append(wing)
            self.tabs.addTab( wing.get_widget(), "Wing: " + wing.get_name() )
        self.rebuildWingLists()
        self.setClean()
예제 #2
0
    def loads(self, stream, fileroot):
        self.wipe_slate()

        design = PropertyNode()
        if props_json.loads(stream, design, ""):
            print("json parse successful")
        else:
            error = QErrorMessage(self)
            error.showMessage("json parse failed")
            return False
        # design.pretty_print()

        self.setWindowTitle(self.default_title + " - " + fileroot)

        node = design.getChild('overview', True)
        self.overview.load(node)

        design.setLen('wing', 1)  # force to be enumerated if not already
        num_wings = design.getLen('wing')
        for i in range(num_wings):
            wing_node = design.getChild('wing[%d]' % i)
            wing = WingUI(changefunc=self.onChange)
            wing.load(wing_node)
            self.wings.append(wing)
            self.tabs.addTab(wing.get_widget(), "Wing: " + wing.get_name())
        self.rebuildWingLists()
        self.setClean()
config = PropertyNode()

if args.camera:
    # seed the camera calibration and distortion coefficients from a
    # known camera config
    print('Setting camera config from:', args.camera)
    props_json.load(args.camera, config)
    config.setString('name', args.camera)
    props_json.save(local_config, config)
elif os.path.exists(local_config):
    # load local config file if it exists
    props_json.load(local_config, config)

name = config.getString('name')
config.setLen('mount_ypr', 3, 0.0)
cam_yaw = config.getFloatEnum('mount_ypr', 0)
cam_pitch = config.getFloatEnum('mount_ypr', 1)
cam_roll = config.getFloatEnum('mount_ypr', 2)

K_list = []
for i in range(9):
    K_list.append(config.getFloatEnum('K', i))
K = np.copy(np.array(K_list)).reshape(3, 3)
dist = []
for i in range(5):
    dist.append(config.getFloatEnum("dist_coeffs", i))

print('Camera:', name)
print('K:\n', K)
print('dist:', dist)