Struct opencv_ros_camera::RosOpenCvIntrinsics
source · pub struct RosOpenCvIntrinsics<R: RealField> {
pub is_opencv_compatible: bool,
pub p: SMatrix<R, 3, 4>,
pub k: SMatrix<R, 3, 3>,
pub distortion: Distortion<R>,
pub rect: SMatrix<R, 3, 3>,
/* private fields */
}Expand description
A perspective camera model with distortion compatible with OpenCV and ROS.
This camera model is compatible with OpenCV and ROS, including stereo
rectification and Brown-Conrady
distortion. To load
from a ROS YAML file, see the from_ros_yaml
function.
See this page for an expanded definition of the parameters.
To convert from a
NamedIntrinsicParameters struct,
use its
intrinsics
field.
Fields§
§is_opencv_compatible: boolIf these intrinsics have zero skew, they are “opencv compatible” and this is true.
p: SMatrix<R, 3, 4>The intrinsic parameter matrix P.
k: SMatrix<R, 3, 3>The intrinsic parameter matrix K. Scaled from P.
distortion: Distortion<R>The non-linear distortion parameters D specifying image warping.
rect: SMatrix<R, 3, 3>The stereo rectification matrix.
Implementations§
source§impl<R: RealField> RosOpenCvIntrinsics<R>
impl<R: RealField> RosOpenCvIntrinsics<R>
sourcepub fn from_components(
p: SMatrix<R, 3, 4>,
k: SMatrix<R, 3, 3>,
distortion: Distortion<R>,
rect: SMatrix<R, 3, 3>
) -> Result<Self>
pub fn from_components( p: SMatrix<R, 3, 4>, k: SMatrix<R, 3, 3>, distortion: Distortion<R>, rect: SMatrix<R, 3, 3> ) -> Result<Self>
Construct intrinsics from raw components.
Returns Err(Error::InvalidInput) if rect cannot be inverted.
sourcepub fn from_params(fx: R, skew: R, fy: R, cx: R, cy: R) -> Self
pub fn from_params(fx: R, skew: R, fy: R, cx: R, cy: R) -> Self
Construct intrinsics from individual parameters with no distortion.
fx and fy are the horizontal and vertical focal lengths. skew is
the pixel skew (typically near zero). cx and cy is the center of the
optical axis in pixel coordinates.
sourcepub fn from_params_with_distortion(
fx: R,
skew: R,
fy: R,
cx: R,
cy: R,
distortion: Distortion<R>
) -> Self
pub fn from_params_with_distortion( fx: R, skew: R, fy: R, cx: R, cy: R, distortion: Distortion<R> ) -> Self
Construct intrinsics from individual parameters.
fx and fy are the horizontal and vertical focal lengths. skew is
the pixel skew (typically near zero). cx and cy is the center of the
optical axis in pixel coordinates. distortion is a vector of the
distortion terms.
sourcepub fn distort<NPTS, IN>(
&self,
undistorted: &UndistortedPixels<R, NPTS, IN>
) -> Pixels<R, NPTS, Owned<R, NPTS, U2>>
pub fn distort<NPTS, IN>( &self, undistorted: &UndistortedPixels<R, NPTS, IN> ) -> Pixels<R, NPTS, Owned<R, NPTS, U2>>
Convert undistorted pixel coordinates to distorted pixel coordinates.
This will take coordinates from, e.g. a linear camera model, warp them into their distorted counterparts. This distortion thus models the action of a real lens.
sourcepub fn undistort<NPTS, IN>(
&self,
distorted: &Pixels<R, NPTS, IN>
) -> UndistortedPixels<R, NPTS, Owned<R, NPTS, U2>>
pub fn undistort<NPTS, IN>( &self, distorted: &Pixels<R, NPTS, IN> ) -> UndistortedPixels<R, NPTS, Owned<R, NPTS, U2>>
Convert distorted pixel coordinates to undistorted pixel coordinates.
This will take distorted coordinates from, e.g. detections from a real camera image, and undo the effect of the distortion model. This “undistortion” thus converts coordinates from a real lens into coordinates that can be used with a linear camera model.
This method calls undistort_ext using the default termination criteria.
sourcepub fn undistort_ext<NPTS, IN>(
&self,
distorted: &Pixels<R, NPTS, IN>,
criteria: impl Into<Option<TermCriteria>>
) -> UndistortedPixels<R, NPTS, Owned<R, NPTS, U2>>
pub fn undistort_ext<NPTS, IN>( &self, distorted: &Pixels<R, NPTS, IN>, criteria: impl Into<Option<TermCriteria>> ) -> UndistortedPixels<R, NPTS, Owned<R, NPTS, U2>>
Convert distorted pixel coordinates to undistorted pixel coordinates.
This will take distorted coordinates from, e.g. detections from a real camera image, and undo the effect of the distortion model. This “undistortion” thus converts coordinates from a real lens into coordinates that can be used with a linear camera model.
If the termination criteria are not specified, the default of five iterations is used.
sourcepub fn camera_to_undistorted_pixel<IN, NPTS>(
&self,
camera: &Points<CameraFrame, R, NPTS, IN>
) -> UndistortedPixels<R, NPTS, Owned<R, NPTS, U2>>
pub fn camera_to_undistorted_pixel<IN, NPTS>( &self, camera: &Points<CameraFrame, R, NPTS, IN> ) -> UndistortedPixels<R, NPTS, Owned<R, NPTS, U2>>
Convert 3D coordinates in CameraFrame to undistorted pixel coords.
sourcepub fn undistorted_pixel_to_camera<IN, NPTS>(
&self,
undistorteds: &UndistortedPixels<R, NPTS, IN>
) -> RayBundle<CameraFrame, SharedOriginRayBundle<R>, R, NPTS, Owned<R, NPTS, U3>>
pub fn undistorted_pixel_to_camera<IN, NPTS>( &self, undistorteds: &UndistortedPixels<R, NPTS, IN> ) -> RayBundle<CameraFrame, SharedOriginRayBundle<R>, R, NPTS, Owned<R, NPTS, U3>>
Convert undistorted pixel coordinates to 3D coords in the CameraFrame.
Trait Implementations§
source§impl<R: Clone + RealField> Clone for RosOpenCvIntrinsics<R>
impl<R: Clone + RealField> Clone for RosOpenCvIntrinsics<R>
source§fn clone(&self) -> RosOpenCvIntrinsics<R>
fn clone(&self) -> RosOpenCvIntrinsics<R>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<'de, R: RealField + Deserialize<'de>> Deserialize<'de> for RosOpenCvIntrinsics<R>
impl<'de, R: RealField + Deserialize<'de>> Deserialize<'de> for RosOpenCvIntrinsics<R>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl<R: RealField> From<IntrinsicParametersPerspective<R>> for RosOpenCvIntrinsics<R>
impl<R: RealField> From<IntrinsicParametersPerspective<R>> for RosOpenCvIntrinsics<R>
source§fn from(orig: IntrinsicParametersPerspective<R>) -> Self
fn from(orig: IntrinsicParametersPerspective<R>) -> Self
source§impl<R: RealField> IntrinsicParameters<R> for RosOpenCvIntrinsics<R>
impl<R: RealField> IntrinsicParameters<R> for RosOpenCvIntrinsics<R>
§type BundleType = SharedOriginRayBundle<R>
type BundleType = SharedOriginRayBundle<R>
source§fn pixel_to_camera<IN, NPTS>(
&self,
pixels: &Pixels<R, NPTS, IN>
) -> RayBundle<CameraFrame, Self::BundleType, R, NPTS, Owned<R, NPTS, U3>>
fn pixel_to_camera<IN, NPTS>( &self, pixels: &Pixels<R, NPTS, IN> ) -> RayBundle<CameraFrame, Self::BundleType, R, NPTS, Owned<R, NPTS, U3>>
source§fn camera_to_pixel<IN, NPTS>(
&self,
camera: &Points<CameraFrame, R, NPTS, IN>
) -> Pixels<R, NPTS, Owned<R, NPTS, U2>>
fn camera_to_pixel<IN, NPTS>( &self, camera: &Points<CameraFrame, R, NPTS, IN> ) -> Pixels<R, NPTS, Owned<R, NPTS, U2>>
source§impl<R: PartialEq + RealField> PartialEq for RosOpenCvIntrinsics<R>
impl<R: PartialEq + RealField> PartialEq for RosOpenCvIntrinsics<R>
source§fn eq(&self, other: &RosOpenCvIntrinsics<R>) -> bool
fn eq(&self, other: &RosOpenCvIntrinsics<R>) -> bool
self and other values to be equal, and is used
by ==.impl<R: RealField> StructuralPartialEq for RosOpenCvIntrinsics<R>
Auto Trait Implementations§
impl<R> Freeze for RosOpenCvIntrinsics<R>where
R: Freeze,
impl<R> RefUnwindSafe for RosOpenCvIntrinsics<R>where
R: RefUnwindSafe,
impl<R> Send for RosOpenCvIntrinsics<R>
impl<R> Sync for RosOpenCvIntrinsics<R>
impl<R> Unpin for RosOpenCvIntrinsics<R>where
R: Unpin,
impl<R> UnwindSafe for RosOpenCvIntrinsics<R>where
R: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.