# This message defines meta information for a camera. It should be in a # camera namespace on topic "camera_info" and accompanied by up to five # image topics named: # image_raw - raw data from the camera driver, possibly Bayer encoded # image - monochrome, distorted # image_color - color, distorted # image_rect - monochrome, rectified # image_rect_color - color, rectified
# Time of image acquisition, camera coordinate frame ID Header header # Header timestamp should be acquisition time of image # Header frame_id should be optical frame of camera # origin of frame should be optical center of cameara # +x should point to the right in the image # +y should point down in the image # +z should point into the plane of the image
# The image dimensions with which the camera was calibrated. # Normally this will be the full camera resolution in pixels. # Note that the camera may provide images at higher or lower resolutions # (e.g. windowed ROI) which are considered to be alternate views of the # same calibration and thus require no recalibration. uint32 height uint32 width
# The distortion model used. Supported models are listed in # sensor_msgs/distortion_models.h. For most cameras, "plumb_bob" - a simple # model of radial and tangential distortion - is sufficient. string distortion_model
# The distortion parameters, size depending on the distortion model. # For "plumb_bob", the 5 parameters are: (k1, k2, t1, t2, k3). float64[] D
# Intrinsic camera matrix for the raw (distorted) images. # [fx 0 cx] # K = [ 0 fy cy] # [ 0 0 1] # Projects 3D points in the camera coordinate frame to 2D pixel # coordinates using the focal lengths (fx, fy) and principal point # (cx, cy). float64[9] K # 3x3 row-major matrix
# Rectification matrix (stereo cameras only) # A rotation matrix aligning the camera coordinate system to the ideal # stereo image plane so that epipolar lines in both stereo images are # parallel. float64[9] R # 3x3 row-major matrix
# Projection/camera matrix # [fx' 0 cx' Tx] # P = [ 0 fy' cy' Ty] # [ 0 0 1 0] # By convention, this matrix specifies the intrinsic (camera) matrix # of the processed (rectified) image. That is, the left 3x3 portion # is the normal camera intrinsic matrix for the rectified image. # It projects 3D points in the camera coordinate frame to 2D pixel # coordinates using the focal lengths (fx', fy') and principal point # (cx', cy'), - these may differ from the values in K. # For monocular cameras, Tx = Ty = 0. Normally, monocular cameras will # also have R = the identity and P[1:3,1:3] = K. float64[12] P # 3x4 row-major matrix
# Binning refers to any camera setting which combines rectangular # neighborhoods of pixels into larger "super-pixels." It reduces the # resolution of the output image to # (width / binning_x) x (height / binning_y). # The default values binning_x = binning_y = 0 is considered the same # as binning_x = binning_y = 1 (no subsampling). uint32 binning_x uint32 binning_y
# Region of interest (subwindow of full camera resolution), given in # full resolution (unbinned) image coordinates. A particular ROI # always denotes the same window of pixels on the camera sensor, # regardless of binning settings. # The default setting of roi (all values 0) is considered the same as # full resolution (roi.width = width, roi.height = height). RegionOfInterest roi
在相机校准中,K 和 P 是两个重要的矩阵,它们分别表示相机的内参矩阵和投影矩阵。以下是它们的内容和区别:
内参矩阵 (Intrinsic Camera Matrix) K
K 是描述相机内在参数的矩阵,用于将 3D 点投影到 2D 图像平面上。它的形式如下:
1 2 3
K = [fx 0 cx] [ 0 fy cy] [ 0 0 1]
fx 和 fy 是相机的焦距,分别对应于 x 和 y 方向。
cx 和 cy 是图像的主点(principal point),即光轴在图像平面上的投影点。
这个矩阵用于将相机坐标系中的 3D 点转换为图像坐标系中的 2D 点。
投影矩阵 (Projection/Camera Matrix) P
P 是描述相机投影参数的矩阵,用于将 3D 点投影到 2D 图像平面上。它的形式如下:
1 2 3
P = [fx' 0 cx' Tx] [ 0 fy' cy' Ty] [ 0 0 1 0]
fx' 和 fy' 是校正后的焦距,分别对应于 x 和 y 方向。
cx' 和 cy' 是校正后的主点。
Tx 和 Ty 是平移参数,通常在单目相机中为 0。
这个矩阵用于将校正后的相机坐标系中的 3D 点转换为图像坐标系中的 2D 点。
区别
K 是内参矩阵,描述的是相机的内在参数,用于未校正(畸变)的图像。
P 是投影矩阵,描述的是相机的投影参数,用于校正后的图像。P 的左上 3x3 部分通常与 K 相同,但可能会有不同的焦距和主点。