CameraFeed

package
v0.0.0-...-e10d1cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsCameraFeed() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsCameraFeed

func (self *Extension[T]) AsCameraFeed() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

type FeedDataType

type FeedDataType int //gd:CameraFeed.FeedDataType
const (
	// No image set for the feed.
	FeedNoimage FeedDataType = 0
	// Feed supplies RGB images.
	FeedRgb FeedDataType = 1
	// Feed supplies YCbCr images that need to be converted to RGB.
	FeedYcbcr FeedDataType = 2
	// Feed supplies separate Y and CbCr images that need to be combined and converted to RGB.
	FeedYcbcrSep FeedDataType = 3
	// Feed supplies external image.
	FeedExternal FeedDataType = 4
)

type FeedPosition

type FeedPosition int //gd:CameraFeed.FeedPosition
const (
	// Unspecified position.
	FeedUnspecified FeedPosition = 0
	// Camera is mounted at the front of the device.
	FeedFront FeedPosition = 1
	// Camera is mounted at the back of the device.
	FeedBack FeedPosition = 2
)

type FormatParameters

type FormatParameters struct {
	Output string `gd:"output"`
}

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type ImageType

type ImageType int //gd:CameraServer.FeedImage
const (
	// The RGBA camera image.
	FeedRgbaImage ImageType = 0
	// The [YCbCr] camera image.
	//
	// [YCbCr]: https://en.wikipedia.org/wiki/YCbCr
	FeedYcbcrImage ImageType = 0
	// The Y component camera image.
	FeedYImage ImageType = 0
	// The CbCr component camera image.
	FeedCbcrImage ImageType = 1
)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.CameraFeed

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsCameraFeed

func (self Instance) AsCameraFeed() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) FeedIsActive

func (self Instance) FeedIsActive() bool

func (Instance) FeedTransform

func (self Instance) FeedTransform() Transform2D.OriginXY

func (Instance) Formats

func (self Instance) Formats() []any

func (Instance) GetDatatype

func (self Instance) GetDatatype() FeedDataType

Returns feed image data type.

func (Instance) GetId

func (self Instance) GetId() int

Returns the unique ID for this feed.

func (Instance) GetName

func (self Instance) GetName() string

Returns the camera's name.

func (Instance) GetPosition

func (self Instance) GetPosition() FeedPosition

Returns the position of camera on the device.

func (Instance) GetTextureTexId

func (self Instance) GetTextureTexId(feed_image_type ImageType) int

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

func (Instance) ID

func (self Instance) ID() ID

func (Instance) OnFormatChanged

func (self Instance) OnFormatChanged(cb func(), flags ...Signal.Flags)

func (Instance) OnFrameChanged

func (self Instance) OnFrameChanged(cb func(), flags ...Signal.Flags)

func (Instance) SetExternal

func (self Instance) SetExternal(width int, height int)

Sets the feed as external feed provided by another library.

func (Instance) SetFeedIsActive

func (self Instance) SetFeedIsActive(value bool)

func (Instance) SetFeedTransform

func (self Instance) SetFeedTransform(value Transform2D.OriginXY)

func (Instance) SetFormat

func (self Instance) SetFormat(index int, parameters FormatParameters) bool

Sets the feed format parameters for the given 'index' in the Formats array. Returns true on success. By default, the YUYV encoded stream is transformed to FeedRgb. The YUYV encoded stream output format can be changed by setting 'parameters”s output entry to one of the following:

- "separate" will result in FeedYcbcrSep;

- "grayscale" will result in desaturated FeedRgb;

- "copy" will result in FeedYcbcr.

func (Instance) SetName

func (self Instance) SetName(name string)

Sets the camera's name.

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetPosition

func (self Instance) SetPosition(position FeedPosition)

Sets the position of this camera.

func (Instance) SetRgbImage

func (self Instance) SetRgbImage(rgb_image Image.Instance)

Sets RGB image for this feed.

func (Instance) SetYcbcrImage

func (self Instance) SetYcbcrImage(ycbcr_image Image.Instance)

Sets YCbCr image for this feed.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	// Called when the camera feed is activated.
	ActivateFeed() bool
	// Called when the camera feed is deactivated.
	DeactivateFeed()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL