Code Monkey home page Code Monkey logo

gyroflow-to-csv's People

Contributors

andrewhazelden avatar daohanlu avatar emberlightvfx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gyroflow-to-csv's Issues

Adjust to latest gyroflow file format

Hi,

In latest dev build, and soon to be v1.5.1, I've changed the format of the extended data a bit. Instead of using bincode I now use standard CBOR, which should be easier to parse

If version == 3, then gyro_data = cbor2.decoder.loads(raw)

This was needed because we now have additional data from certain files, like per-frame offset, per-frame exposure time and hopefully soon per-frame lens profile information. Adding all these additional information using bincode would be pretty hard to parse in external tools, so I decided to switch to CBOR, which has parsers in all languages

raw_imu and quaternions fields were removed from gyro_source. Instead, there's now file_metadata there which contains:

pub struct FileMetadata {
    pub imu_orientation:     Option<String>,
    pub raw_imu:             Vec<telemetry_parser::util::IMUData>, 
    pub quaternions:         BTreeMap<i64, Quaternion<f64>>,
    pub gravity_vectors:     Option<BTreeMap<i64, Vector3<f64>>>,
    pub image_orientations:  Option<BTreeMap<i64, Quaternion<f64>>>,
    pub detected_source:     Option<String>,
    pub frame_readout_time:  Option<f64>,
    pub frame_rate:          Option<f64>,
    pub camera_identifier:   Option<CameraIdentifier>,
    pub lens_profile:        Option<serde_json::Value>,
    pub lens_positions:      Option<BTreeMap<i64, f64>>,
    pub has_accurate_timestamps: bool,
    pub additional_data:     serde_json::Value,
    pub per_frame_time_offsets: Vec<f64>,
    pub per_frame_data:      Vec<serde_json::Value>,
}

// definition of telemetry_parser::util::IMUData
pub struct IMUData {
    pub timestamp_ms: f64,
    pub gyro: Option<[f64; 3]>,
    pub accl: Option<[f64; 3]>,
    pub magn: Option<[f64; 3]>
}

// definition of CameraIdentifier
pub struct CameraIdentifier {
    pub brand: String,
    pub model: String,
    pub lens_model: String,
    pub lens_info: String,
    pub focal_length: Option<f64>,
    pub camera_setting: String,
    pub fps: usize,
    pub video_width: usize,
    pub video_height: usize,
    pub additional: String,
    pub identifier: String
}

Additionally, I added:

  • synced_imu_timestamps - array of timestamps for every IMU sample, with added interpolated offsets
  • synced_imu_timestamps_with_per_frame_offset - same as above + per frame time offset, which involves exposure time and custom VSYNC offset from the file metadata - this is the final offset. The timestamps represent middle of the frame, ie. in case of 59.94 video, 0 is the middle row of first frame, 16.68 middle row of the second frame etc.
  • adaptive_zoom_fovs - per frame smoothed FOV for adaptive zoom

So instead of interpolating the offsets on your side in python, you can just use imu.timestamp = synced_imu_timestamps_with_per_frame_offset[imu_index]

file_metadata = cbor2.decoder.loads(zlib.decompress(decode(data['gyro_source']['file_metadata'])))
synced_imu_timestamps_with_per_frame_offset = cbor2.decoder.loads(zlib.decompress(decode(data['gyro_source']['synced_imu_timestamps_with_per_frame_offset'])))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.