Struct riscan_pro::CameraCalibration
[−]
[src]
pub struct CameraCalibration { pub name: String, pub cx: f64, pub cy: f64, pub fx: f64, pub fy: f64, pub k1: f64, pub k2: f64, pub k3: f64, pub k4: f64, pub p1: f64, pub p2: f64, pub tan_max_horz: f64, pub tan_max_vert: f64, pub tan_min_horz: f64, pub tan_min_vert: f64, pub width: usize, pub height: usize, }
A camera calibration.
Only opencv camera calibrations are supported at this time.
Fields
name: String
The name of the calibration.
cx: f64
cy: f64
fx: f64
fy: f64
k1: f64
k2: f64
k3: f64
k4: f64
p1: f64
p2: f64
tan_max_horz: f64
tan_max_vert: f64
tan_min_horz: f64
tan_min_vert: f64
width: usize
height: usize
Methods
impl CameraCalibration
[src]
fn from_project_path<P: AsRef<Path>>(path: P) -> Result<Vec<CameraCalibration>>
[src]
Retrieves all camera calibrations from a project.
Examples
use riscan_pro::CameraCalibration; let camera_calibrations = CameraCalibration::from_project_path("data/project.RiSCAN") .unwrap(); assert_eq!(1, camera_calibrations.len());
fn cmcs_to_ics(&self, point: &Point<Cmcs>) -> Option<(f64, f64)>
[src]
Converts a point in the camera's coordinate system to pixel values.
The pixel values are floats, in case someone later wants to do more than a direct lookup.
Returns None if:
- The point is behind the camera (negative z).
- The point is ouside the angle extents, as defined by
tan_{min|max}_{vert|horz}
. - The calculated pixel values are outside of the width/height of the image.
These maths are taken from the project.dtd
file in every RiSCAN Pro project.
Examples
use riscan_pro::{CameraCalibration, Point}; let camera_calibration = CameraCalibration::from_project_path("data/southpole.rsp") .unwrap() .pop() .unwrap(); let cmcs = Point::cmcs(1.312, -0.641, 3.019); let (u, v) = camera_calibration.cmcs_to_ics(&cmcs).unwrap();
fn is_valid_pixel<T: Into<f64>>(&self, u: T, v: T) -> bool
[src]
Returns true if this is a valid pixel value.
Examples
use riscan_pro::CameraCalibration; let camera_calibration = CameraCalibration::from_project_path("data/project.RiSCAN") .unwrap() .pop() .unwrap(); // The camera calibration is 1024x768 assert!(camera_calibration.is_valid_pixel(0., 0.)); assert!(!camera_calibration.is_valid_pixel(1024., 0.)); assert!(!camera_calibration.is_valid_pixel(0., 768.));
Trait Implementations
impl Clone for CameraCalibration
[src]
fn clone(&self) -> CameraCalibration
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for CameraCalibration
[src]
impl PartialEq for CameraCalibration
[src]
fn eq(&self, __arg_0: &CameraCalibration) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &CameraCalibration) -> bool
[src]
This method tests for !=
.