docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ImageMsg

    ROS sensor_msgs/Image message.

    Inheritance
    object
    ImageMsg
    Implements
    IMessage
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.SimulationPro.Foundation.SensorMessages
    Assembly: Unity.SimulationPro.Foundation.dll
    Syntax
    [Serializable]
    public class ImageMsg : IMessage

    Constructors

    ImageMsg()

    actual matrix data, size is (step * rows)

    Declaration
    public ImageMsg()

    ImageMsg(HeaderMsg, uint, uint, string, byte, uint, byte[])

    Initializes a new instance with default values.

    Declaration
    public ImageMsg(HeaderMsg header, uint height, uint width, string encoding, byte is_bigendian, uint step, byte[] data)
    Parameters
    Type Name Description
    HeaderMsg header

    ROS message header containing timestamp and coordinate frame identifier.

    uint height

    Image height in pixels.

    uint width

    Image width in pixels.

    string encoding

    Pixel encoding format (e.g. "rgb8", "bgr8", "mono8").

    byte is_bigendian

    Whether multi-byte values use big-endian byte order.

    uint step

    Full row length in bytes, including any padding.

    byte[] data

    The payload data for this message.

    Fields

    data

    Full row length in bytes

    Declaration
    public byte[] data
    Field Value
    Type Description
    byte[]

    encoding

    image width, that is, number of columns The legal values for encoding are in file src/image_encodings.cpp If you want to standardize a new string format, join ros-users@lists.ros.org and send an email proposing a new encoding.

    Declaration
    public string encoding
    Field Value
    Type Description
    string

    header

    This message contains an uncompressed image (0, 0) is at top-left corner of image

    Declaration
    public HeaderMsg header
    Field Value
    Type Description
    HeaderMsg

    height

    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 to plane of the image If the frame_id here and the frame_id of the CameraInfo message associated with the image conflict the behavior is undefined

    Declaration
    public uint height
    Field Value
    Type Description
    uint

    is_bigendian

    Encoding of pixels -- channel meaning, ordering, size taken from the list of strings in include/sensor_msgs/image_encodings.hpp

    Declaration
    public byte is_bigendian
    Field Value
    Type Description
    byte

    k_MessageTypeId

    Identifier for this message type.

    Declaration
    public static readonly MessageTypeId k_MessageTypeId
    Field Value
    Type Description
    MessageTypeId

    k_MessageTypeName

    The ROS message type name string used for serialization and topic matching.

    Declaration
    public const string k_MessageTypeName = "sensor_msgs/Image"
    Field Value
    Type Description
    string

    step

    is this data bigendian?

    Declaration
    public uint step
    Field Value
    Type Description
    uint

    width

    image height, that is, number of rows

    Declaration
    public uint width
    Field Value
    Type Description
    uint

    Properties

    MessageTypeId

    Gets the unique runtime identifier for this message type.

    Declaration
    public MessageTypeId MessageTypeId { get; }
    Property Value
    Type Description
    MessageTypeId

    MessageTypeName

    Gets the ROS message type name for this message.

    Declaration
    public string MessageTypeName { get; }
    Property Value
    Type Description
    string

    Methods

    Deserialize(IMessageDeserializer)

    Deserializes a ImageMsg from the given deserializer.

    Declaration
    public static ImageMsg Deserialize(IMessageDeserializer deserializer)
    Parameters
    Type Name Description
    IMessageDeserializer deserializer

    The deserializer.

    Returns
    Type Description
    ImageMsg

    A new ImageMsg instance.

    Register()

    Registers this message type with the MessageTypeRegistry.

    Declaration
    [InitializeOnLoadMethod]
    public static void Register()

    ToString()

    Returns a human-readable string representation of this message.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string representation of this instance.

    Overrides
    object.ToString()

    WriteTo(IMessageSerializer)

    Serializes this message to the given serializer.

    Declaration
    public void WriteTo(IMessageSerializer serializer)
    Parameters
    Type Name Description
    IMessageSerializer serializer

    The serializer.

    Implements

    IMessage

    Extension Methods

    MessageExtensions.DebayerConvert(ImageMsg, bool)
    MessageExtensions.EncodingRequiresBGRConversion(ImageMsg)
    MessageExtensions.GetBytesPerChannel(ImageMsg)
    MessageExtensions.GetNumChannels(ImageMsg)
    MessageExtensions.GetTextureFormat(ImageMsg)
    MessageExtensions.IsBayerEncoded(ImageMsg)
    MessageExtensions.ToTexture2D(ImageMsg, bool, bool, bool)
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)