CameraInfo
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.
| Property | Type | Description |
|---|---|---|
Id | string | The camera's unique id (its serial number). |
Name | string | The camera's display name, or Id when it has none. |
Type | string | The kind of camera driver, for example "GeniCam". |
IsConnected | bool | Whether the camera is connected and sending video. |
ServerHost | string | The IP address of the camera server the camera is plugged into. |
Width | int | Image width, in pixels. |
Height | int | Image height, in pixels. |
FrameRate | int | Frames per second the camera captures. |
Calibration | CameraCalibration? | Intrinsic and extrinsic calibration values, or null when the camera is not calibrated. |
Related types
Small types used by this record, documented here.
CameraCalibration
record · sealedpublic sealed record CameraCalibration(float Fx, float Fy, float Cx, float Cy, LensDistortion Distortion, Matrix4x4 WorldToCamera);
A camera's calibration values, in the OpenCV convention.
| Property | Type | Description |
|---|---|---|
Fx | float | Focal length along X, in pixels. |
Fy | float | Focal length along Y, in pixels. |
Cx | float | Principal point X, in pixels. |
Cy | float | Principal point Y, in pixels. |
Distortion | LensDistortion | Lens distortion coefficients. |
WorldToCamera | Matrix4x4 | Transforms 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 · readonlypublic 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).
| Property | Type | Description |
|---|---|---|
K1 | float | First radial coefficient. |
K2 | float | Second radial coefficient. |
P1 | float | First tangential coefficient. |
P2 | float | Second tangential coefficient. |
K3 | float | Third radial coefficient. |
See also
- Cameras guide — walkthrough with a complete, compiled sample
- Class index — every AR51.Net type
- Data conventions, threading and errors
Was this page helpful?