Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
CameraServer
繼承: Object
追蹤 Godot 中可存取的不同攝像頭的伺服器。
說明
The CameraServer keeps track of different cameras accessible in Godot. These are external cameras such as webcams or the cameras on your phone.
It is notably used to provide AR modules with a video feed from the camera.
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.
屬性
|
方法
void |
add_feed(feed: CameraFeed) |
feeds() |
|
void |
remove_feed(feed: CameraFeed) |
訊號
當新增 CameraFeed 時發出(例如插入網路攝像頭時)。
camera_feed_removed(id: int) 🔗
當移除 CameraFeed 時發出(例如拔掉網路攝像頭時)。
camera_feeds_updated() 🔗
Emitted when camera feeds are updated.
列舉
enum FeedImage: 🔗
FeedImage FEED_RGBA_IMAGE = 0
RGBA 相機圖像。
FeedImage FEED_YCBCR_IMAGE = 0
YCbCr 相機圖像。
FeedImage FEED_Y_IMAGE = 0
Y 分量相機圖像。
FeedImage FEED_CBCR_IMAGE = 1
CbCr 分量相機圖像。
屬性說明
bool monitoring_feeds = false 🔗
If true, the server is actively monitoring available camera feeds.
This has a performance cost, so only set it to true when you're actively accessing the camera.
Note: After setting it to true, you can receive updated camera feeds through the camera_feeds_updated signal.
func _ready():
CameraServer.camera_feeds_updated.connect(_on_camera_feeds_updated)
CameraServer.monitoring_feeds = true
func _on_camera_feeds_updated():
var feeds = CameraServer.feeds()
public override void _Ready()
{
CameraServer.CameraFeedsUpdated += OnCameraFeedsUpdated;
CameraServer.MonitoringFeeds = true;
}
void OnCameraFeedsUpdated()
{
var feeds = CameraServer.Feeds();
}
方法說明
void add_feed(feed: CameraFeed) 🔗
將相機源 feed 新增到相機伺服器中。
Array[CameraFeed] feeds() 🔗
返回一個 CameraFeed 陣列。
CameraFeed get_feed(index: int) 🔗
返回與給定索引 index 的相機對應的 CameraFeed。
返回註冊的 CameraFeed 的數量。
void remove_feed(feed: CameraFeed) 🔗
移除指定的相機源 feed。