Initial commit
This commit is contained in:
153
srcs/RobotNet10/Shared/RobotNet10.Shared/Sensor/CameraInfo.cs
Normal file
153
srcs/RobotNet10/Shared/RobotNet10.Shared/Sensor/CameraInfo.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
namespace RobotNet10.Shared.Sensor;
|
||||
|
||||
/// <summary>
|
||||
/// CameraInfo message (sensor_msgs/CameraInfo)
|
||||
/// This message defines meta information for a camera
|
||||
/// </summary>
|
||||
public struct CameraInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Header with timestamp and frame ID
|
||||
/// </summary>
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Image height (rows)
|
||||
/// </summary>
|
||||
public uint Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Image width (columns)
|
||||
/// </summary>
|
||||
public uint Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Distortion model constants
|
||||
/// </summary>
|
||||
public const string DistortionModelPlumbBob = "plumb_bob";
|
||||
public const string DistortionModelRationalPolynomial = "rational_polynomial";
|
||||
|
||||
/// <summary>
|
||||
/// The distortion model used
|
||||
/// </summary>
|
||||
public string DistortionModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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).
|
||||
/// </summary>
|
||||
public double[] K { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of intrinsic camera matrix (3x3 = 9 elements)
|
||||
/// </summary>
|
||||
public const int KSize = 9;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public double[] R { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of rectification matrix (3x3 = 9 elements)
|
||||
/// </summary>
|
||||
public const int RSize = 9;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public double[] P { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of projection matrix (3x4 = 12 elements)
|
||||
/// </summary>
|
||||
public const int PSize = 12;
|
||||
|
||||
/// <summary>
|
||||
/// The distortion parameters, size depending on the distortion model.
|
||||
/// For "plumb_bob", the 5 parameters are: (k1, k2, t1, t2, k3).
|
||||
/// </summary>
|
||||
public double[] D { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Region of interest (subwindow of full camera resolution)
|
||||
/// </summary>
|
||||
public RegionOfInterest Roi { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public CameraInfo()
|
||||
{
|
||||
Header = new Header();
|
||||
Height = 0;
|
||||
Width = 0;
|
||||
DistortionModel = DistortionModelPlumbBob;
|
||||
K = new double[KSize];
|
||||
R = new double[RSize];
|
||||
P = new double[PSize];
|
||||
D = [];
|
||||
Roi = new RegionOfInterest();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RegionOfInterest message (sensor_msgs/RegionOfInterest)
|
||||
/// This message is used to specify a region of interest within an image
|
||||
/// </summary>
|
||||
public struct RegionOfInterest
|
||||
{
|
||||
/// <summary>
|
||||
/// Leftmost pixel of the ROI
|
||||
/// </summary>
|
||||
public uint XOffset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Topmost pixel of the ROI
|
||||
/// </summary>
|
||||
public uint YOffset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Height of ROI
|
||||
/// </summary>
|
||||
public uint Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Width of ROI
|
||||
/// </summary>
|
||||
public uint Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True if a distinct rectified ROI should be calculated from the "raw"
|
||||
/// ROI in this message. Typically this should be False on the "raw" image
|
||||
/// and True on the "rectified" image.
|
||||
/// </summary>
|
||||
public bool DoRectify { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public RegionOfInterest()
|
||||
{
|
||||
XOffset = 0;
|
||||
YOffset = 0;
|
||||
Height = 0;
|
||||
Width = 0;
|
||||
DoRectify = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user