Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Camera::resolutions #10

Open
spacekookie opened this issue Feb 23, 2018 · 1 comment
Open

Documentation for Camera::resolutions #10

spacekookie opened this issue Feb 23, 2018 · 1 comment

Comments

@spacekookie
Copy link

Hey there. Your bindings look really cool, thanks for writing them :)

I'm having a big of an issue though with camera.resolutions(...). It's nowhere documented what numbers to provide it and since I can't really find any good docs online either I was wondering if you could add some explanation to the function comment.

@loyd
Copy link
Owner

loyd commented Feb 25, 2018

Hi, thanks for the question. I will try to add some information to the documentation in the future.

If you run formats example, you'll see something like this:

MJPG (Motion-JPEG, compressed)
  1280x720  Discretes: 30fps
  848x480  Discretes: 30fps
  960x540  Discretes: 30fps
YUYV (YUYV 4:2:2)
  640x480  Discretes: 30fps
  160x120  Discretes: 30fps
  320x180  Discretes: 30fps
  320x240  Discretes: 30fps
  424x240  Discretes: 30fps
  640x360  Discretes: 30fps
RGB3 (RGB3, emulated)
  1280x720  Discretes: 30fps
  848x480  Discretes: 30fps
  960x540  Discretes: 30fps
  640x480  Discretes: 30fps
  160x120  Discretes: 30fps
  320x180  Discretes: 30fps
  320x240  Discretes: 30fps
  424x240  Discretes: 30fps
  640x360  Discretes: 30fps
...

For every format (hardware supported by the camera or emulated by the driver) there is list of supported resolutions (sizes of frames) that you can get using Camera::resolutions method.

The result of the method is a simple structure:

pub enum ResolutionInfo {         // Examples
    Discretes(Vec<(u32, u32)>),   // Discretes(vec![(640, 360), (424, 240), (320, 240)])
    Stepwise {                    // Stepwise {
        min: (u32, u32),          //     min: (320, 240),
        max: (u32, u32),          //     max: (640, 360),
        step: (u32, u32)          //     step: (10, 10)
    }                             // }
}

Every variant (Discretes or Stepwise) represents a set of sizes (pairs (width, height)).

In the example Stepwise variant represents

{ ∀k≥0,m≥0 | (min(320 + k*step.0, 640), min(240 + m*step.1, 360)) }

Did I answer the question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants