CameraFeed
继承: RefCounted
< Object
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.
属性
方法
FeedDataType | get_datatype ( ) const1 |
int | get_id ( ) const1 |
String | get_name ( ) const1 |
FeedPosition | get_position ( ) const1 |
int | get_texture_tex_id ( feed_image_type: FeedImage ) |
void | set_external ( width: int , height: int ) |
bool | set_format ( index: int , parameters: Dictionary ) |
void | set_name ( name: String ) |
void | set_position ( position: FeedPosition ) |
void | set_rgb_image ( rgb_image: Image ) |
void | set_ycbcr_image ( ycbcr_image: Image ) |
信号
format_changed ( )
Emitted when the format has changed.
frame_changed ( )
Emitted when a new frame is available.
枚举
enum FeedDataType:
FeedDataType FEED_NOIMAGE = 0
No image set for the feed.
FeedDataType FEED_RGB = 1
Feed supplies RGB images.
FeedDataType FEED_YCBCR = 2
Feed supplies YCbCr images that need to be converted to RGB.
FeedDataType FEED_YCBCR_SEP = 3
Feed supplies separate Y and CbCr images that need to be combined and converted to RGB.
FeedDataType FEED_EXTERNAL = 4
Feed supplies external image.
enum FeedPosition:
FeedPosition FEED_UNSPECIFIED = 0
Unspecified position.
FeedPosition FEED_FRONT = 1
Camera is mounted at the front of the device.
FeedPosition FEED_BACK = 2
Camera is mounted at the back of the device.
属性说明
bool
feed_is_active = false
If true
, the feed is active.
Transform2D
feed_transform = Transform2D(1, 0, 0, -1, 0, 1)
void
set_transform ( value:Transform2D
)Transform2D
get_transform ( )
The transform applied to the camera's image.
Array
formats = []
Array
get_formats ( )
Formats supported by the feed. Each entry is a Dictionary
describing format parameters.
方法说明
FeedDataType get_datatype ( ) const1
Returns feed image data type.
Returns the unique ID for this feed.
Returns the camera's name.
FeedPosition get_position ( ) const1
Returns the position of camera on the device.
int
get_texture_tex_id ( feed_image_type: FeedImage )
Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data).
void
set_external ( width: int
, height: int
)
Sets the feed as external feed provided by another library.
bool
set_format ( index: int
, parameters: Dictionary
)
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
void
set_name ( name: String
)
Sets the camera's name.
void
set_position ( position: FeedPosition )
Sets the position of this camera.
void
set_rgb_image ( rgb_image: Image
)
Sets RGB image for this feed.
void
set_ycbcr_image ( ycbcr_image: Image
)
Sets YCbCr image for this feed.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。