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 ¶
- type Advanced
- type Any
- type Extension
- type FeedDataType
- type FeedPosition
- type FormatParameters
- type ID
- type ImageType
- type Implementation
- type Instance
- func (self Instance) AsCameraFeed() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) FeedIsActive() bool
- func (self Instance) FeedTransform() Transform2D.OriginXY
- func (self Instance) Formats() []any
- func (self Instance) GetDatatype() FeedDataType
- func (self Instance) GetId() int
- func (self Instance) GetName() string
- func (self Instance) GetPosition() FeedPosition
- func (self Instance) GetTextureTexId(feed_image_type ImageType) int
- func (self Instance) ID() ID
- func (self Instance) OnFormatChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnFrameChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) SetExternal(width int, height int)
- func (self Instance) SetFeedIsActive(value bool)
- func (self Instance) SetFeedTransform(value Transform2D.OriginXY)
- func (self Instance) SetFormat(index int, parameters FormatParameters) bool
- func (self Instance) SetName(name string)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetPosition(position FeedPosition)
- func (self Instance) SetRgbImage(rgb_image Image.Instance)
- func (self Instance) SetYcbcrImage(ycbcr_image Image.Instance)
- func (self Instance) Virtual(name string) reflect.Value
- type Interface
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 Extension ¶
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 (*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 ¶
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.
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 (Instance) AsCameraFeed ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) FeedIsActive ¶
func (Instance) FeedTransform ¶
func (self Instance) FeedTransform() Transform2D.OriginXY
func (Instance) GetDatatype ¶
func (self Instance) GetDatatype() FeedDataType
Returns feed image data type.
func (Instance) GetPosition ¶
func (self Instance) GetPosition() FeedPosition
Returns the position of camera on the device.
func (Instance) GetTextureTexId ¶
Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data).
func (Instance) OnFormatChanged ¶
func (Instance) OnFrameChanged ¶
func (Instance) SetExternal ¶
Sets the feed as external feed provided by another library.
func (Instance) SetFeedIsActive ¶
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) SetPosition ¶
func (self Instance) SetPosition(position FeedPosition)
Sets the position of this camera.
func (Instance) SetRgbImage ¶
Sets RGB image for this feed.
func (Instance) SetYcbcrImage ¶
Sets YCbCr image for this feed.