示例#1
0
    def get_interpolated_stab_transform(self, start=0, interval=1 / 29.97):
        if self.smoothing_algo:
            if self.smoothing_algo.bypass_external_processing:
                print("Bypassing quaternion orientation integration")
                return self.get_interpolated_stab_transform_old(
                    start=start, interval=interval)
                #time_list, smoothed_orientation = self.smoothing_algo.get_stabilize_transform(self.gyro)
        else:
            self.smoothing_algo = smoothing_algos.PlainSlerp()

        time_list, interp_orientations = self.get_interpolated_orientations(
            start=start, interval=interval)
        time_list = np.array(time_list)
        interp_orientations = np.array(interp_orientations)

        _, smoothed_orientations = self.smoothing_algo.get_smooth_orientations(
            time_list, interp_orientations)
        smoothed_orientations = np.array(smoothed_orientations)

        stab_rotations = np.zeros(smoothed_orientations.shape)

        for i in range(smoothed_orientations.shape[0]):
            # rotation quaternion from smooth motion -> raw motion to counteract it
            stab_rotations[i, :] = quat.rot_between(smoothed_orientations[i],
                                                    interp_orientations[i])

        return time_list, stab_rotations
示例#2
0
    def get_stabilize_transform(self, smooth=0.94):
        time_list, smoothed_orientation = self.get_smoothed_orientation(smooth)

        # rotations that'll stabilize the camera
        stab_rotations = np.zeros(self.orientation_list.shape)

        for i in range(self.num_data_points):
            # rotation quaternion from smooth motion -> raw motion to counteract it
            stab_rotations[i, :] = quat.rot_between(smoothed_orientation[i],
                                                    self.orientation_list[i])

        return (self.time_list, stab_rotations)