CameraFeed
A camera feed gives you access to a single physical camera attached to your device.
A camera feed gives you access to a single physical camera attached to your device.
A camera feed gives you access to a single physical camera attached to your device. When enabled, Reckfell will start capturing frames from the camera which can then be used. See also CameraServer.
Note: Many cameras will return YCbCr images which are split into two textures and need to be combined in a shader. Reckfell does this automatically for you if you set the environment to show the camera image in the background.
Note: This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no CameraFeeds will be available. To get a CameraFeed on iOS, enable EditorExportPlatformIOS.modules/camera.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
CameraFeedConstructor
public CameraFeed();Properties3
FeedIsActiveProperty
public bool FeedIsActive { get; set; }If true, the feed is active.
FeedTransformProperty
public Transform2D FeedTransform { get; set; }The transform applied to the camera's image.
FormatsProperty
public Reckfell.Collections.Array Formats { get; }Formats supported by the feed. Each entry is a Reckfell.Collections.Dictionary describing format parameters.
Methods21
GetDatatypeCameraFeed.FeedDataType
public CameraFeed.FeedDataType GetDatatype();Returns feed image data type.
CameraFeed.FeedDataTypeGetFormatsReckfell.Collections.Array
public Reckfell.Collections.Array GetFormats();Override this method to define supported formats of the camera feed.
Reckfell.Collections.ArrayGetIdint
public int GetId();Returns the unique ID for this feed.
intGetNamestring
public string GetName();Returns the camera's name.
stringGetPositionCameraFeed.FeedPosition
public CameraFeed.FeedPosition GetPosition();Returns the position of camera on the device.
CameraFeed.FeedPositionGetTextureTexIdulong
public ulong GetTextureTexId(CameraServer.FeedImage feedImageType);Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data).
| Name | Type | Default |
|---|---|---|
feedImageType | CameraServer.FeedImage | — |
ulongGetTransformTransform2D
public Transform2D GetTransform();Transform2DIsActivebool
public bool IsActive();boolSetActivevoid
public void SetActive(bool active);| Name | Type | Default |
|---|---|---|
active | bool | — |
SetExternalvoid
public void SetExternal(int width, int height);Sets the feed as external feed provided by another library.
| Name | Type | Default |
|---|---|---|
width | int | — |
height | int | — |
SetFormatbool
public bool SetFormat(int index, Reckfell.Collections.Dictionary parameters);Override this method to set the format of the camera feed.
| Name | Type | Default |
|---|---|---|
index | int | — |
parameters | Reckfell.Collections.Dictionary | — |
boolSetNamevoid
public void SetName(string name);Sets the camera's name.
| Name | Type | Default |
|---|---|---|
name | string | — |
SetPositionvoid
public void SetPosition(CameraFeed.FeedPosition position);Sets the position of this camera.
| Name | Type | Default |
|---|---|---|
position | CameraFeed.FeedPosition | — |
SetRgbImagevoid
public void SetRgbImage(Image rgbImage);Sets RGB image for this feed.
| Name | Type | Default |
|---|---|---|
rgbImage | Image | — |
SetTransformvoid
public void SetTransform(Transform2D transform);| Name | Type | Default |
|---|---|---|
transform | Transform2D | — |
SetYcbcrImagevoid
public void SetYcbcrImage(Image ycbcrImage);Sets YCbCr image for this feed.
| Name | Type | Default |
|---|---|---|
ycbcrImage | Image | — |
SetYcbcrImagesvoid
public void SetYcbcrImages(Image yImage, Image cbcrImage);Sets Y and CbCr images for this feed.
| Name | Type | Default |
|---|---|---|
yImage | Image | — |
cbcrImage | Image | — |
_ActivateFeedbool
public virtual bool _ActivateFeed();Called when the camera feed is activated.
bool_DeactivateFeedvoid
public virtual void _DeactivateFeed();Called when the camera feed is deactivated.
_GetFormatsReckfell.Collections.Array
public virtual Reckfell.Collections.Array _GetFormats();Override this method to define supported formats of the camera feed.
Reckfell.Collections.Array_SetFormatbool
public virtual bool _SetFormat(int index, Reckfell.Collections.Dictionary parameters);Override this method to set the format of the camera feed.
| Name | Type | Default |
|---|---|---|
index | int | — |
parameters | Reckfell.Collections.Dictionary | — |
boolSignals and events2
FormatChangedEvent
public event Action FormatChanged;Emitted when the format has changed.
FrameChangedEvent
public event Action FrameChanged;Emitted when a new frame is available.
CameraFeed.FeedDataType
| Value | Description |
|---|---|
External = 4 | Feed supplies external image. |
Noimage = 0 | No image set for the feed. |
Rgb = 1 | Feed supplies RGB images. |
Ycbcr = 2 | Feed supplies YCbCr images that need to be converted to RGB. |
YcbcrSep = 3 | Feed supplies separate Y and CbCr images that need to be combined and converted to RGB. |
CameraFeed.FeedPosition
| Value | Description |
|---|---|
Back = 2 | Camera is mounted at the back of the device. |
Front = 1 | Camera is mounted at the front of the device. |
Unspecified = 0 | Unspecified position. |