123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CameraFeed.xml.
- .. _class_CameraFeed:
- CameraFeed
- ==========
- **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- A camera feed gives you access to a single physical camera attached to your device.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- 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 :ref:`CameraServer<class_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.
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`feed_is_active<class_CameraFeed_property_feed_is_active>` | ``false`` |
- +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
- | :ref:`Transform2D<class_Transform2D>` | :ref:`feed_transform<class_CameraFeed_property_feed_transform>` | ``Transform2D(1, 0, 0, -1, 0, 1)`` |
- +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
- | :ref:`Array<class_Array>` | :ref:`formats<class_CameraFeed_property_formats>` | ``[]`` |
- +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` | :ref:`get_datatype<class_CameraFeed_method_get_datatype>`\ (\ ) |const| |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_id<class_CameraFeed_method_get_id>`\ (\ ) |const| |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_String>` | :ref:`get_name<class_CameraFeed_method_get_name>`\ (\ ) |const| |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` | :ref:`get_position<class_CameraFeed_method_get_position>`\ (\ ) |const| |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_texture_tex_id<class_CameraFeed_method_get_texture_tex_id>`\ (\ feed_image_type\: :ref:`FeedImage<enum_CameraServer_FeedImage>`\ ) |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_external<class_CameraFeed_method_set_external>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`\ ) |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`set_format<class_CameraFeed_method_set_format>`\ (\ index\: :ref:`int<class_int>`, parameters\: :ref:`Dictionary<class_Dictionary>`\ ) |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_name<class_CameraFeed_method_set_name>`\ (\ name\: :ref:`String<class_String>`\ ) |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_position<class_CameraFeed_method_set_position>`\ (\ position\: :ref:`FeedPosition<enum_CameraFeed_FeedPosition>`\ ) |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_rgb_image<class_CameraFeed_method_set_rgb_image>`\ (\ rgb_image\: :ref:`Image<class_Image>`\ ) |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_ycbcr_image<class_CameraFeed_method_set_ycbcr_image>`\ (\ ycbcr_image\: :ref:`Image<class_Image>`\ ) |
- +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Signals
- -------
- .. _class_CameraFeed_signal_format_changed:
- .. rst-class:: classref-signal
- **format_changed**\ (\ ) :ref:`🔗<class_CameraFeed_signal_format_changed>`
- Emitted when the format has changed.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_signal_frame_changed:
- .. rst-class:: classref-signal
- **frame_changed**\ (\ ) :ref:`🔗<class_CameraFeed_signal_frame_changed>`
- Emitted when a new frame is available.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Enumerations
- ------------
- .. _enum_CameraFeed_FeedDataType:
- .. rst-class:: classref-enumeration
- enum **FeedDataType**: :ref:`🔗<enum_CameraFeed_FeedDataType>`
- .. _class_CameraFeed_constant_FEED_NOIMAGE:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_NOIMAGE** = ``0``
- No image set for the feed.
- .. _class_CameraFeed_constant_FEED_RGB:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_RGB** = ``1``
- Feed supplies RGB images.
- .. _class_CameraFeed_constant_FEED_YCBCR:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_YCBCR** = ``2``
- Feed supplies YCbCr images that need to be converted to RGB.
- .. _class_CameraFeed_constant_FEED_YCBCR_SEP:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_YCBCR_SEP** = ``3``
- Feed supplies separate Y and CbCr images that need to be combined and converted to RGB.
- .. _class_CameraFeed_constant_FEED_EXTERNAL:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_EXTERNAL** = ``4``
- Feed supplies external image.
- .. rst-class:: classref-item-separator
- ----
- .. _enum_CameraFeed_FeedPosition:
- .. rst-class:: classref-enumeration
- enum **FeedPosition**: :ref:`🔗<enum_CameraFeed_FeedPosition>`
- .. _class_CameraFeed_constant_FEED_UNSPECIFIED:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **FEED_UNSPECIFIED** = ``0``
- Unspecified position.
- .. _class_CameraFeed_constant_FEED_FRONT:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **FEED_FRONT** = ``1``
- Camera is mounted at the front of the device.
- .. _class_CameraFeed_constant_FEED_BACK:
- .. rst-class:: classref-enumeration-constant
- :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **FEED_BACK** = ``2``
- Camera is mounted at the back of the device.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_CameraFeed_property_feed_is_active:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **feed_is_active** = ``false`` :ref:`🔗<class_CameraFeed_property_feed_is_active>`
- .. rst-class:: classref-property-setget
- - |void| **set_active**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_active**\ (\ )
- If ``true``, the feed is active.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_property_feed_transform:
- .. rst-class:: classref-property
- :ref:`Transform2D<class_Transform2D>` **feed_transform** = ``Transform2D(1, 0, 0, -1, 0, 1)`` :ref:`🔗<class_CameraFeed_property_feed_transform>`
- .. rst-class:: classref-property-setget
- - |void| **set_transform**\ (\ value\: :ref:`Transform2D<class_Transform2D>`\ )
- - :ref:`Transform2D<class_Transform2D>` **get_transform**\ (\ )
- The transform applied to the camera's image.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_property_formats:
- .. rst-class:: classref-property
- :ref:`Array<class_Array>` **formats** = ``[]`` :ref:`🔗<class_CameraFeed_property_formats>`
- .. rst-class:: classref-property-setget
- - :ref:`Array<class_Array>` **get_formats**\ (\ )
- Formats supported by the feed. Each entry is a :ref:`Dictionary<class_Dictionary>` describing format parameters.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_CameraFeed_method_get_datatype:
- .. rst-class:: classref-method
- :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **get_datatype**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_datatype>`
- Returns feed image data type.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_get_id:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_id**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_id>`
- Returns the unique ID for this feed.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_get_name:
- .. rst-class:: classref-method
- :ref:`String<class_String>` **get_name**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_name>`
- Returns the camera's name.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_get_position:
- .. rst-class:: classref-method
- :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **get_position**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_position>`
- Returns the position of camera on the device.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_get_texture_tex_id:
- .. rst-class:: classref-method
- :ref:`int<class_int>` **get_texture_tex_id**\ (\ feed_image_type\: :ref:`FeedImage<enum_CameraServer_FeedImage>`\ ) :ref:`🔗<class_CameraFeed_method_get_texture_tex_id>`
- Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data).
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_set_external:
- .. rst-class:: classref-method
- |void| **set_external**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`\ ) :ref:`🔗<class_CameraFeed_method_set_external>`
- Sets the feed as external feed provided by another library.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_set_format:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **set_format**\ (\ index\: :ref:`int<class_int>`, parameters\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_CameraFeed_method_set_format>`
- Sets the feed format parameters for the given index in the :ref:`formats<class_CameraFeed_property_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
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_set_name:
- .. rst-class:: classref-method
- |void| **set_name**\ (\ name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_CameraFeed_method_set_name>`
- Sets the camera's name.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_set_position:
- .. rst-class:: classref-method
- |void| **set_position**\ (\ position\: :ref:`FeedPosition<enum_CameraFeed_FeedPosition>`\ ) :ref:`🔗<class_CameraFeed_method_set_position>`
- Sets the position of this camera.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_set_rgb_image:
- .. rst-class:: classref-method
- |void| **set_rgb_image**\ (\ rgb_image\: :ref:`Image<class_Image>`\ ) :ref:`🔗<class_CameraFeed_method_set_rgb_image>`
- Sets RGB image for this feed.
- .. rst-class:: classref-item-separator
- ----
- .. _class_CameraFeed_method_set_ycbcr_image:
- .. rst-class:: classref-method
- |void| **set_ycbcr_image**\ (\ ycbcr_image\: :ref:`Image<class_Image>`\ ) :ref:`🔗<class_CameraFeed_method_set_ycbcr_image>`
- Sets YCbCr image for this feed.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|