Skip to main content

CameraInfo

record · sealed thread-safe
namespace AR51.Net;

public sealed record CameraInfo(string Id, string Name, string Type, bool IsConnected, string ServerHost, int Width, int Height, int FrameRate, CameraCalibration? Calibration);

An AR 51 camera.

Units

Positions are in meters, in the AR 51 world: left-handed, X right, Y up, Z forward (the same axes as Unity). See Data conventions.

How-to

This page is reference (facts only). For a walkthrough with a complete sample, see the Cameras guide.

Example
// The camera's position in the AR 51 world, from its calibration.
if (camera.Calibration is { } calibration && Matrix4x4.Invert(calibration.WorldToCamera, out Matrix4x4 cameraToWorld))
Console.WriteLine($"{camera.Name} is at {cameraToWorld.Translation} m");

Properties​

Positional record: set them in the constructor, read them as properties, and copy with changes using with.

PropertyTypeDescription
IdstringThe camera's unique id (its serial number).
NamestringThe camera's display name, or Id when it has none.
TypestringThe kind of camera driver, for example "GeniCam".
IsConnectedboolWhether the camera is connected and sending video.
ServerHoststringThe IP address of the camera server the camera is plugged into.
WidthintImage width, in pixels.
HeightintImage height, in pixels.
FrameRateintFrames per second the camera captures.
CalibrationCameraCalibration?Intrinsic and extrinsic calibration values, or null when the camera is not calibrated.

Small types used by this record, documented here.

CameraCalibration​

record · sealed
public sealed record CameraCalibration(float Fx, float Fy, float Cx, float Cy, LensDistortion Distortion, Matrix4x4 WorldToCamera);

A camera's calibration values, in the OpenCV convention.

PropertyTypeDescription
FxfloatFocal length along X, in pixels.
FyfloatFocal length along Y, in pixels.
CxfloatPrincipal point X, in pixels.
CyfloatPrincipal point Y, in pixels.
DistortionLensDistortionLens distortion coefficients.
WorldToCameraMatrix4x4Transforms an AR 51 world point (meters; left-handed, X right, Y up, Z forward) into the camera's space (meters; X right, Y down, Z forward, as in OpenCV): Vector3.Transform(worldPoint, WorldToCamera). The pixel is then (Fx · x / z + Cx, Fy · y / z + Cy), before distortion.

LensDistortion​

record struct · readonly
public readonly record struct LensDistortion(float K1, float K2, float P1, float P2, float K3);

Lens distortion coefficients, in the OpenCV order (k1, k2, p1, p2, k3).

PropertyTypeDescription
K1floatFirst radial coefficient.
K2floatSecond radial coefficient.
P1floatFirst tangential coefficient.
P2floatSecond tangential coefficient.
K3floatThird radial coefficient.

See also​

Was this page helpful?