sensor_msgs/msg/CameraInfo消息解释

sensor_msgs/msg/CameraInfo消息解释

在 ros2 中,输入命令行 ros2 interface show sensor_msgs/msg/CameraInfo 可以查看 sensor_msgs/msg/CameraInfo 的具体内容及解释:

    # 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
    #
    # The image_pipeline contains packages (image_proc, stereo_image_proc)
    # for producing the four processed image topics from image_raw and
    # camera_info. The meaning of the camera parameters are described in
    # detail at http://www.ros.org/wiki/image_pipeline/CameraInfo.
    #
    # The image_geometry package provides a user-friendly interface to
    # common operations using this meta information. If you want to, e.g.,
    # project a 3d point into image coordinates, we strongly recommend
    # using image_geometry.
    #
    # If the camera is uncalibrated, the matrices D, K, R, P should be left
    # zeroed out. In particular, clients may assume that K[0] == 0.0
    # indicates an uncalibrated camera.

    #######################################################################
    #                     Image acquisition info                          #
    #######################################################################

    # Time of image acquisition, camera coordinate frame ID
    std_msgs/Header header # Header timestamp should be acquisition time of image
        builtin_interfaces/Time stamp
            int32 sec
            uint32 nanosec
        string frame_id
                                # Header frame_id should be optical frame of camera
                                # origin of frame should be optical center of camera
                                # +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


    #######################################################################
    #                      Calibration Parameters                         #
    #######################################################################
    # These are fixed during camera calibration. Their values will be the #
    # same in all messages until the camera is recalibrated. Note that    #
    # self-calibrating systems may "recalibrate" frequently.              #
    #                                                                     #
    # The internal parameters can be used to warp a raw (distorted) image #
    # to:                                                                 #
    #   1. An undistorted image (requires D and K)                        #
    #   2. A rectified image (requires D, K, R)                           #
    # The projection matrix P projects 3D points into the rectified image.#
    #######################################################################

    # The image dimensions with which the camera was calibrated.
    # Normally this will be the full camera resolution in pixels.
    uint32 height
    uint32 width

    # The distortion model used. Supported models are listed in
    # sensor_msgs/distortion_models.hpp. For most cameras, "plumb_bob" - a
    # simple model of radial and tangential distortion - is sufficent.
    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.
    # For a stereo pair, the fourth column [Tx Ty 0]' is related to the
    #  position of the optical center of the second camera in the first
    #  camera's frame. We assume Tz = 0 so both cameras are in the same
    #  stereo image plane. The first camera always has Tx = Ty = 0. For
    #  the right (second) camera of a horizontal stereo pair, Ty = 0 and
    #  Tx = -fx' * B, where B is the baseline between the cameras.
    # Given a 3D point [X Y Z]', the projection (x, y) of the point onto
    #  the rectified image is given by:
    #  [u v w]' = P * [X Y Z 1]'
    #         x = u / w
    #         y = v / w
    #  This holds for both images of a stereo pair.
    float64[12] p # 3x4 row-major matrix


    #######################################################################
    #                      Operational Parameters                         #
    #######################################################################
    # These define the image region actually captured by the camera       #
    # driver. Although they affect the geometry of the output image, they #
    # may be changed freely without recalibrating the camera.             #
    #######################################################################

    # Binning refers here 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
        #
        uint32 x_offset  #
                        # (0 if the ROI includes the left edge of the image)
        uint32 y_offset  #
                        # (0 if the ROI includes the top edge of the image)
        uint32 height    #
        uint32 width     #
        bool do_rectify

对上面的内容进行翻译:

    # 该消息定义相机的元信息。 它应该位于主题“camera_info”的相机命名空间中,并附带最多五个图像主题,名称为:

    #   image_raw - 来自相机驱动程序的原始数据,可能是Bayer编码的
    #   image - 单色、有畸变
    #   image_color - 颜色,有畸变
    #   image_rect - 单色,校正
    #   image_rect_color - 颜色,已校正


    # image_pipeline 包含用于从 image_raw 和camera_info 生成四个已处理图像主题的包(image_proc、stereo_image_proc)。 
    # 相机参数的含义在http://www.ros.org/wiki/image_pipeline/CameraInfo中有详细描述。

    # image_geometry 包为使用此元信息的常见操作提供了一个用户友好的界面。 
    # 例如,如果您想将 3d 点投影到图像坐标中,我们强烈建议使用 image_geometry。

    # 如果相机未校准,则矩阵 D、K、R、P 应保留为零。 特别是,客户可能会假设 K[0] == 0.0 表示相机未校准。


    ########################################################################
    #                           图像获取信息                                 #
    ########################################################################

    # 图像采集时间、相机坐标系ID
    std_msgs/Header header # 标头时间戳应该是图像的获取时间
        builtin_interfaces/Time stamp
            int32 sec
            uint32 nanosec
        string frame_id
                                # 标头frame_id应该是相机的光学框架 原点应该是相机的光学中心
                                # +x 应该指向图像的右侧
                                # +y 在图像中应该指向下方
                                # +z 应指向图像平面

    ########################################################################
    #                           校准参数                                    #
    ########################################################################
    # 这些在相机校准期间修复。 在重新校准相机之前,所有消息中的它们的值都将相同。      #
    # 请注意,自校准系统可能会频繁“重新校准”。                                   #
    #                                                                      #
    # 内部参数可用于将原始(扭曲)图像扭曲为:                                    #
    # 1. 未失真的图像(需要 D 和 K)                                           #
    # 2. 校正后的图像(需要D、K、R)                                           #
    # 投影矩阵 P 将 3D 点投影到校正图像中。                                     #
    ########################################################################

    # 相机校准所用的图像尺寸。
    # 通常这将是完整的相机分辨率(以像素为单位)。
    uint32 height
    uint32 width

    # 使用的失真模型。 受支持的模型在sensor_msgs/ Distortion_models.hpp中列出。 
    # 对于大多数相机来说,“plumb_bob”——径向和切向畸变的简单模型——就足够了。
    string distortion_model

    # 畸变参数,大小取决于畸变模型。
    # 对于“plumb_bob”,5个参数是:(k1, k2, t1, t2, k3)。
    float64[] d

    # 原始(扭曲)图像的固有相机矩阵。
    #     [fx  0 cx]
    # K = [ 0 fy cy]
    #     [ 0  0  1]
    # 使用焦距 (fx, fy) 和主点 (cx, cy) 将相机坐标系中的 3D 点投影到 2D 像素坐标。
    float64[9] k     # 3x3 矩阵以行为主

    # 校正矩阵(仅限立体相机)
    # 将相机坐标系与理想立体图像平面对齐的旋转矩阵,以便两个立体图像中的极线平行。
    float64[9] r # 3x3 行主矩阵

    # 投影/相机矩阵
    #     [fx' 0  cx' Tx]
    # P = [ 0 fy' cy' Ty]
    #     [ 0  0   1   0]
    # 按照惯例,该矩阵指定已处理(校正)图像的固有(相机)矩阵。 也就是说,左侧 3x3 部分是校正图像的普通相机固有矩阵。
    # 它使用焦距 (fx', fy') 和主点 (cx', cy') 将相机坐标系中的 3D 点投影到 2D 像素坐标 - 这些可能与 K 中的值不同。
    # 对于单目相机,Tx = Ty = 0。通常,单目相机也会有R = 身份和P[1:3,1:3] = K。
    # 对于立体对,第四列[Tx Ty 0]'与第二个相机的光学中心在第一个相机的帧中的位置相关。 
    # 我们假设 Tz = 0,因此两个摄像机位于同一立体图像平面中。 第一个摄像机始终具有 Tx = Ty = 0。
    # 对于水平立体对的右侧(第二个)摄像机,Ty = 0 且 Tx = -fx' * B,其中 B 是摄像机之间的基线。
    # 给定一个 3D 点 [X Y Z]',该点在校正图像上的投影 (x, y) 由下式给出:
    #   [u v w]' = P * [X Y Z 1]'
    #          x = u / w
    #          y = v / w
    # 这适用于立体图像对的两个图像。
    float64[12] p # 3x4 行主矩阵


    ########################################################################
    #                               操作参数                                #
    ########################################################################
    # 这些定义了相机驱动程序实际捕获的图像区域。                                  #
    # 尽管它们会影响输出图像的几何形状,但它们可以自由更改,而无需重新校准相机。       #
    ########################################################################

    # 合并在这里指的是任何将像素的矩形邻域组合成更大的“超像素”的相机设置。 它将输出图像的分辨率降低为 (width / binning_x) x (height / binning_y)。
    # 默认值 binning_x = binning_y = 0 被认为与 binning_x = binning_y = 1 相同(无子采样)。
    uint32 binning_x
    uint32 binning_y

    # 感兴趣区域(全相机分辨率的子窗口),以全分辨率(未合并)图像坐标给出。 无论分级设置如何,特定的 ROI 始终表示相机传感器上的相同像素窗口。
    # roi 的默认设置(所有值均为 0)被认为与全分辨率相同(roi.width = 宽度,roi.height = 高度)。
    RegionOfInterest roi
        #
        uint32 x_offset  #
                        #(如果 ROI 包括图像的左边缘,则为 0)
        uint32 y_offset  #
                        #(如果 ROI 包括图像的上边缘,则为 0)
        uint32 height    #
        uint32 width     #
        bool do_rectify
posted @ 2024-03-27 09:47  逍遥鱼儿叹大海  阅读(1337)  评论(0)    收藏  举报