Inheritance #

RefCounted

- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
CameraFeed

Table of contents

CameraFeed #

is_refcounted, is_instantiable, core, not_builtin_classes

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, Godot 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. Godot 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, macOS, and iOS. On other platforms no CameraFeeds will be available. To get a CameraFeed on iOS, the camera plugin from godot-ios-plugins is required.

Members #

var feed_is_active: bool = false#

If true, the feed is active.

var feed_transform: Transform2D = Transform2D(1, 0, 0, -1, 0, 1)#

The transform applied to the camera's image.

var formats: Array = []#

Formats supported by the feed. Each entry is a Dictionary describing format parameters.

Methods #

virtual func _activate_feed() -> bool#

Called when the camera feed is activated.

virtual func _deactivate_feed() -> void#

Called when the camera feed is deactivated.

const func get_datatype() -> intCameraFeed.FeedDataType#

Returns feed image data type.

const func get_id() -> int#

Returns the unique ID for this feed.

const func get_name() -> String#

Returns the camera's name.

const func get_position() -> intCameraFeed.FeedPosition#

Returns the position of camera on the device.

func get_texture_tex_id(feed_image_type: int enumCameraServer.FeedImage) -> int#

Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data).

func set_external(height: int) -> void#

Sets the feed as external feed provided by another library.

func set_format(parameters: Dictionary) -> bool#

Sets the feed format parameters for the given index in the formats array. Returns true on success. By default YUYV encoded stream is transformed to FEED_RGB. YUYV encoded stream output format can be changed with parameters.output value:

separate will result in FEED_YCBCR_SEP

grayscale will result in desaturated FEED_RGB

copy will result in FEED_YCBCR

func set_name(name: String) -> void#

Sets the camera's name.

func set_position(position: int enumCameraFeed.FeedPosition) -> void#

Sets the position of this camera.

func set_rgb_image(rgb_image: Image) -> void#

Sets RGB image for this feed.

func set_ycbcr_image(ycbcr_image: Image) -> void#

Sets YCbCr image for this feed.

Annotations #

Constants #

const FEED_NOIMAGE = 0 enum FeedDataType#

No image set for the feed.

const FEED_RGB = 1 enum FeedDataType#

Feed supplies RGB images.

const FEED_YCBCR = 2 enum FeedDataType#

Feed supplies YCbCr images that need to be converted to RGB.

const FEED_YCBCR_SEP = 3 enum FeedDataType#

Feed supplies separate Y and CbCr images that need to be combined and converted to RGB.

const FEED_EXTERNAL = 4 enum FeedDataType#

Feed supplies external image.

const FEED_UNSPECIFIED = 0 enum FeedPosition#

Unspecified position.

const FEED_FRONT = 1 enum FeedPosition#

Camera is mounted at the front of the device.

const FEED_BACK = 2 enum FeedPosition#

Camera is mounted at the back of the device.

Constructors #

Enums #

FeedDataType#

enum FeedDataType { FEED_NOIMAGE = 0, FEED_RGB = 1, FEED_YCBCR = 2, FEED_YCBCR_SEP = 3, FEED_EXTERNAL = 4, }

FeedPosition#

enum FeedPosition { FEED_UNSPECIFIED = 0, FEED_FRONT = 1, FEED_BACK = 2, }

Operators #

Signals #

signal format_changed()#

Emitted when the format has changed.

signal frame_changed()#

Emitted when a new frame is available.

Theme Items #

Tutorials #