2121/// If the camera is uncalibrated, the matrices D, K, R, P should be left
2222/// zeroed out. In particular, clients may assume that K[0] == 0.0
2323/// indicates an uncalibrated camera.
24-
25- /// Time of image acquisition, camera coordinate frame ID
24+ ///
25+ /// # Calibration Parameters
26+ ///
27+ /// These are fixed during camera calibration. Their values will be the
28+ /// same in all messages until the camera is recalibrated. Note that
29+ /// self-calibrating systems may "recalibrate" frequently.
30+ ///
31+ /// The internal parameters can be used to warp a raw (distorted) image
32+ /// to:
33+ /// 1. An undistorted image (requires D and K)
34+ /// 2. A rectified image (requires D, K, R)
35+ /// The projection matrix P projects 3D points into the rectified image.
36+ ///
37+ /// The image dimensions with which the camera was calibrated.
38+ /// Normally this will be the full camera resolution in pixels.
2639use serde:: { Deserialize , Serialize } ;
2740
2841use crate :: { sensor_msgs:: region_of_interest:: RegionOfInterest , std_msgs:: header:: Header } ;
2942
3043#[ derive( Debug , Serialize , Deserialize ) ]
3144pub struct CameraInfo {
32- pub header : Header ,
45+ /// Time of image acquisition, camera coordinate frame ID
3346 /// Header timestamp should be acquisition time of image
3447 /// Header frame_id should be optical frame of camera
48+ pub header : Header ,
49+
3550 /// origin of frame should be optical center of camera
3651 /// +x should point to the right in the image
3752 /// +y should point down in the image
3853 /// +z should point into the plane of the image
39-
40- ///######################################################################
41- /// Calibration Parameters #
42- ///######################################################################
43- /// These are fixed during camera calibration. Their values will be the #
44- /// same in all messages until the camera is recalibrated. Note that #
45- /// self-calibrating systems may "recalibrate" frequently. #
46- /// #
47- /// The internal parameters can be used to warp a raw (distorted) image #
48- /// to: #
49- /// 1. An undistorted image (requires D and K) #
50- /// 2. A rectified image (requires D, K, R) #
51- /// The projection matrix P projects 3D points into the rectified image.#
52- ///######################################################################
53-
54- /// The image dimensions with which the camera was calibrated.
55- /// Normally this will be the full camera resolution in pixels.
5654 pub height : u32 ,
5755 pub width : u32 ,
5856
@@ -79,58 +77,63 @@ pub struct CameraInfo {
7977 /// A rotation matrix aligning the camera coordinate system to the ideal
8078 /// stereo image plane so that epipolar lines in both stereo images are
8179 /// parallel.
82- pub r : [ f64 ; 9 ] ,
8380 /// 3x3 row-major matrix
81+ pub r : [ f64 ; 9 ] ,
8482
8583 /// Projection/camera matrix
8684 /// [fx' 0 cx' Tx]
8785 /// P = [ 0 fy' cy' Ty]
8886 /// [ 0 0 1 0]
8987 /// By convention, this matrix specifies the intrinsic (camera) matrix
90- /// of the processed (rectified) image. That is, the left 3x3 portion
91- /// is the normal camera intrinsic matrix for the rectified image.
88+ /// of the processed (rectified) image. That is, the left 3x3 portion
89+ /// is the normal camera intrinsic matrix for the rectified image.
90+ ///
9291 /// It projects 3D points in the camera coordinate frame to 2D pixel
93- /// coordinates using the focal lengths (fx', fy') and principal point
94- /// (cx', cy') - these may differ from the values in K.
92+ /// coordinates using the focal lengths (fx', fy') and principal point
93+ /// (cx', cy') - these may differ from the values in K.
94+ ///
9595 /// For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will
96- /// also have R = the identity and P[1:3,1:3] = K.
96+ /// also have R = the identity and P[1:3,1:3] = K.
97+ ///
9798 /// For a stereo pair, the fourth column [Tx Ty 0]' is related to the
98- /// position of the optical center of the second camera in the first
99- /// camera's frame. We assume Tz = 0 so both cameras are in the same
100- /// stereo image plane. The first camera always has Tx = Ty = 0. For
101- /// the right (second) camera of a horizontal stereo pair, Ty = 0 and
102- /// Tx = -fx' * B, where B is the baseline between the cameras.
99+ /// position of the optical center of the second camera in the first
100+ /// camera's frame. We assume Tz = 0 so both cameras are in the same
101+ /// stereo image plane. The first camera always has Tx = Ty = 0. For
102+ /// the right (second) camera of a horizontal stereo pair, Ty = 0 and
103+ /// Tx = -fx' * B, where B is the baseline between the cameras.
104+ ///
103105 /// Given a 3D point [X Y Z]', the projection (x, y) of the point onto
104- /// the rectified image is given by:
105- /// [u v w]' = P * [X Y Z 1]'
106- /// x = u / w
107- /// y = v / w
108- /// This holds for both images of a stereo pair.
109- pub p : [ f64 ; 12 ] ,
106+ /// the rectified image is given by:
107+ /// [u v w]' = P * [X Y Z 1]'
108+ /// x = u / w
109+ /// y = v / w
110+ /// This holds for both images of a stereo pair.
111+ ///
110112 /// 3x4 row-major matrix
113+ pub p : [ f64 ; 12 ] ,
111114
112- ///######################################################################
113- /// Operational Parameters #
114- ///######################################################################
115- /// These define the image region actually captured by the camera #
116- /// driver. Although they affect the geometry of the output image, they #
117- /// may be changed freely without recalibrating the camera. #
118- ///######################################################################
119-
115+ /// # Operational Parameters
116+ ///
117+ /// These define the image region actually captured by the camera
118+ /// driver. Although they affect the geometry of the output image, they
119+ /// may be changed freely without recalibrating the camera.
120+ ///
120121 /// Binning refers here to any camera setting which combines rectangular
121- /// neighborhoods of pixels into larger "crate-pixels." It reduces the
122- /// resolution of the output image to
123- /// (width / binning_x) x (height / binning_y).
122+ /// neighborhoods of pixels into larger "crate-pixels." It reduces the
123+ /// resolution of the output image to
124+ /// (width / binning_x) x (height / binning_y).
125+ ///
124126 /// The default values binning_x = binning_y = 0 is considered the same
125- /// as binning_x = binning_y = 1 (no subsampling).
127+ /// as binning_x = binning_y = 1 (no subsampling).
126128 pub binning_x : u32 ,
127129 pub binning_y : u32 ,
128130
129131 /// Region of interest (subwindow of full camera resolution), given in
130- /// full resolution (unbinned) image coordinates. A particular ROI
131- /// always denotes the same window of pixels on the camera sensor,
132- /// regardless of binning settings.
132+ /// full resolution (unbinned) image coordinates. A particular ROI
133+ /// always denotes the same window of pixels on the camera sensor,
134+ /// regardless of binning settings.
135+ ///
133136 /// The default setting of roi (all values 0) is considered the same as
134- /// full resolution (roi.width = width, roi.height = height).
137+ /// full resolution (roi.width = width, roi.height = height).
135138 pub roi : RegionOfInterest ,
136139}
0 commit comments