# CameraInfo

<Badge tone="type">record · sealed</Badge> <Badge>thread-safe</Badge>

```csharp
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.

:::note[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](/docs/csharp-api/conventions/).
:::

:::tip[How-to]
This page is **reference** (facts only). For a walkthrough with a complete sample, see the [Cameras guide](/docs/csharp-api/cameras/).
:::

<Example>

```csharp
// 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");
```

</Example>

## Properties

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

<div className="apiPropTable apiTable">

| 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?`](#cameracalibration) | Intrinsic and extrinsic calibration values, or `null` when the camera is not calibrated. |

</div>

## Related types

Small types used by this record, documented here.

### CameraCalibration

<Badge tone="type">record · sealed</Badge>

```csharp
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.

<div className="apiTable">

| 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`](#lensdistortion) | Lens distortion coefficients. |
| `WorldToCamera` | [`Matrix4x4`](https://learn.microsoft.com/en-us/dotnet/api/system.numerics.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. |

</div>

### LensDistortion

<Badge tone="type">record struct · readonly</Badge>

```csharp
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).

<div className="apiTable">

| 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. |

</div>

## See also

- [Cameras guide](/docs/csharp-api/cameras/) — walkthrough with a complete, compiled sample
- [Class index](/docs/sdk-api/csharp-api/classes/) — every AR51.Net type
- [Data conventions, threading and errors](/docs/csharp-api/conventions/)
