class_camerafeed.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/CameraFeed.xml.
  6. .. _class_CameraFeed:
  7. CameraFeed
  8. ==========
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. A camera feed gives you access to a single physical camera attached to your device.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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>`.
  15. \ **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.
  16. \ **Note:** This class is currently only implemented on Linux, macOS, and iOS. On other platforms no **CameraFeed**\ s will be available. To get a **CameraFeed** on iOS, the camera plugin from `godot-ios-plugins <https://github.com/godotengine/godot-ios-plugins>`__ is required.
  17. .. rst-class:: classref-reftable-group
  18. Properties
  19. ----------
  20. .. table::
  21. :widths: auto
  22. +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`feed_is_active<class_CameraFeed_property_feed_is_active>` | ``false`` |
  24. +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
  25. | :ref:`Transform2D<class_Transform2D>` | :ref:`feed_transform<class_CameraFeed_property_feed_transform>` | ``Transform2D(1, 0, 0, -1, 0, 1)`` |
  26. +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
  27. | :ref:`Array<class_Array>` | :ref:`formats<class_CameraFeed_property_formats>` | ``[]`` |
  28. +---------------------------------------+-----------------------------------------------------------------+------------------------------------+
  29. .. rst-class:: classref-reftable-group
  30. Methods
  31. -------
  32. .. table::
  33. :widths: auto
  34. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`_activate_feed<class_CameraFeed_private_method__activate_feed>`\ (\ ) |virtual| |
  36. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  37. | |void| | :ref:`_deactivate_feed<class_CameraFeed_private_method__deactivate_feed>`\ (\ ) |virtual| |
  38. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` | :ref:`get_datatype<class_CameraFeed_method_get_datatype>`\ (\ ) |const| |
  40. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`get_id<class_CameraFeed_method_get_id>`\ (\ ) |const| |
  42. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`String<class_String>` | :ref:`get_name<class_CameraFeed_method_get_name>`\ (\ ) |const| |
  44. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` | :ref:`get_position<class_CameraFeed_method_get_position>`\ (\ ) |const| |
  46. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`get_texture_tex_id<class_CameraFeed_method_get_texture_tex_id>`\ (\ feed_image_type\: :ref:`FeedImage<enum_CameraServer_FeedImage>`\ ) |
  48. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  49. | |void| | :ref:`set_external<class_CameraFeed_method_set_external>`\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`\ ) |
  50. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`set_format<class_CameraFeed_method_set_format>`\ (\ index\: :ref:`int<class_int>`, parameters\: :ref:`Dictionary<class_Dictionary>`\ ) |
  52. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  53. | |void| | :ref:`set_name<class_CameraFeed_method_set_name>`\ (\ name\: :ref:`String<class_String>`\ ) |
  54. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  55. | |void| | :ref:`set_position<class_CameraFeed_method_set_position>`\ (\ position\: :ref:`FeedPosition<enum_CameraFeed_FeedPosition>`\ ) |
  56. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  57. | |void| | :ref:`set_rgb_image<class_CameraFeed_method_set_rgb_image>`\ (\ rgb_image\: :ref:`Image<class_Image>`\ ) |
  58. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  59. | |void| | :ref:`set_ycbcr_image<class_CameraFeed_method_set_ycbcr_image>`\ (\ ycbcr_image\: :ref:`Image<class_Image>`\ ) |
  60. +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
  61. .. rst-class:: classref-section-separator
  62. ----
  63. .. rst-class:: classref-descriptions-group
  64. Signals
  65. -------
  66. .. _class_CameraFeed_signal_format_changed:
  67. .. rst-class:: classref-signal
  68. **format_changed**\ (\ ) :ref:`🔗<class_CameraFeed_signal_format_changed>`
  69. Emitted when the format has changed.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_CameraFeed_signal_frame_changed:
  73. .. rst-class:: classref-signal
  74. **frame_changed**\ (\ ) :ref:`🔗<class_CameraFeed_signal_frame_changed>`
  75. Emitted when a new frame is available.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Enumerations
  80. ------------
  81. .. _enum_CameraFeed_FeedDataType:
  82. .. rst-class:: classref-enumeration
  83. enum **FeedDataType**: :ref:`🔗<enum_CameraFeed_FeedDataType>`
  84. .. _class_CameraFeed_constant_FEED_NOIMAGE:
  85. .. rst-class:: classref-enumeration-constant
  86. :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_NOIMAGE** = ``0``
  87. No image set for the feed.
  88. .. _class_CameraFeed_constant_FEED_RGB:
  89. .. rst-class:: classref-enumeration-constant
  90. :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_RGB** = ``1``
  91. Feed supplies RGB images.
  92. .. _class_CameraFeed_constant_FEED_YCBCR:
  93. .. rst-class:: classref-enumeration-constant
  94. :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_YCBCR** = ``2``
  95. Feed supplies YCbCr images that need to be converted to RGB.
  96. .. _class_CameraFeed_constant_FEED_YCBCR_SEP:
  97. .. rst-class:: classref-enumeration-constant
  98. :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_YCBCR_SEP** = ``3``
  99. Feed supplies separate Y and CbCr images that need to be combined and converted to RGB.
  100. .. _class_CameraFeed_constant_FEED_EXTERNAL:
  101. .. rst-class:: classref-enumeration-constant
  102. :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **FEED_EXTERNAL** = ``4``
  103. Feed supplies external image.
  104. .. rst-class:: classref-item-separator
  105. ----
  106. .. _enum_CameraFeed_FeedPosition:
  107. .. rst-class:: classref-enumeration
  108. enum **FeedPosition**: :ref:`🔗<enum_CameraFeed_FeedPosition>`
  109. .. _class_CameraFeed_constant_FEED_UNSPECIFIED:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **FEED_UNSPECIFIED** = ``0``
  112. Unspecified position.
  113. .. _class_CameraFeed_constant_FEED_FRONT:
  114. .. rst-class:: classref-enumeration-constant
  115. :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **FEED_FRONT** = ``1``
  116. Camera is mounted at the front of the device.
  117. .. _class_CameraFeed_constant_FEED_BACK:
  118. .. rst-class:: classref-enumeration-constant
  119. :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **FEED_BACK** = ``2``
  120. Camera is mounted at the back of the device.
  121. .. rst-class:: classref-section-separator
  122. ----
  123. .. rst-class:: classref-descriptions-group
  124. Property Descriptions
  125. ---------------------
  126. .. _class_CameraFeed_property_feed_is_active:
  127. .. rst-class:: classref-property
  128. :ref:`bool<class_bool>` **feed_is_active** = ``false`` :ref:`🔗<class_CameraFeed_property_feed_is_active>`
  129. .. rst-class:: classref-property-setget
  130. - |void| **set_active**\ (\ value\: :ref:`bool<class_bool>`\ )
  131. - :ref:`bool<class_bool>` **is_active**\ (\ )
  132. If ``true``, the feed is active.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_CameraFeed_property_feed_transform:
  136. .. rst-class:: classref-property
  137. :ref:`Transform2D<class_Transform2D>` **feed_transform** = ``Transform2D(1, 0, 0, -1, 0, 1)`` :ref:`🔗<class_CameraFeed_property_feed_transform>`
  138. .. rst-class:: classref-property-setget
  139. - |void| **set_transform**\ (\ value\: :ref:`Transform2D<class_Transform2D>`\ )
  140. - :ref:`Transform2D<class_Transform2D>` **get_transform**\ (\ )
  141. The transform applied to the camera's image.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_CameraFeed_property_formats:
  145. .. rst-class:: classref-property
  146. :ref:`Array<class_Array>` **formats** = ``[]`` :ref:`🔗<class_CameraFeed_property_formats>`
  147. .. rst-class:: classref-property-setget
  148. - :ref:`Array<class_Array>` **get_formats**\ (\ )
  149. Formats supported by the feed. Each entry is a :ref:`Dictionary<class_Dictionary>` describing format parameters.
  150. .. rst-class:: classref-section-separator
  151. ----
  152. .. rst-class:: classref-descriptions-group
  153. Method Descriptions
  154. -------------------
  155. .. _class_CameraFeed_private_method__activate_feed:
  156. .. rst-class:: classref-method
  157. :ref:`bool<class_bool>` **_activate_feed**\ (\ ) |virtual| :ref:`🔗<class_CameraFeed_private_method__activate_feed>`
  158. Called when the camera feed is activated.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_CameraFeed_private_method__deactivate_feed:
  162. .. rst-class:: classref-method
  163. |void| **_deactivate_feed**\ (\ ) |virtual| :ref:`🔗<class_CameraFeed_private_method__deactivate_feed>`
  164. Called when the camera feed is deactivated.
  165. .. rst-class:: classref-item-separator
  166. ----
  167. .. _class_CameraFeed_method_get_datatype:
  168. .. rst-class:: classref-method
  169. :ref:`FeedDataType<enum_CameraFeed_FeedDataType>` **get_datatype**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_datatype>`
  170. Returns feed image data type.
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_CameraFeed_method_get_id:
  174. .. rst-class:: classref-method
  175. :ref:`int<class_int>` **get_id**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_id>`
  176. Returns the unique ID for this feed.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_CameraFeed_method_get_name:
  180. .. rst-class:: classref-method
  181. :ref:`String<class_String>` **get_name**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_name>`
  182. Returns the camera's name.
  183. .. rst-class:: classref-item-separator
  184. ----
  185. .. _class_CameraFeed_method_get_position:
  186. .. rst-class:: classref-method
  187. :ref:`FeedPosition<enum_CameraFeed_FeedPosition>` **get_position**\ (\ ) |const| :ref:`🔗<class_CameraFeed_method_get_position>`
  188. Returns the position of camera on the device.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_CameraFeed_method_get_texture_tex_id:
  192. .. rst-class:: classref-method
  193. :ref:`int<class_int>` **get_texture_tex_id**\ (\ feed_image_type\: :ref:`FeedImage<enum_CameraServer_FeedImage>`\ ) :ref:`🔗<class_CameraFeed_method_get_texture_tex_id>`
  194. Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data).
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_CameraFeed_method_set_external:
  198. .. rst-class:: classref-method
  199. |void| **set_external**\ (\ width\: :ref:`int<class_int>`, height\: :ref:`int<class_int>`\ ) :ref:`🔗<class_CameraFeed_method_set_external>`
  200. Sets the feed as external feed provided by another library.
  201. .. rst-class:: classref-item-separator
  202. ----
  203. .. _class_CameraFeed_method_set_format:
  204. .. rst-class:: classref-method
  205. :ref:`bool<class_bool>` **set_format**\ (\ index\: :ref:`int<class_int>`, parameters\: :ref:`Dictionary<class_Dictionary>`\ ) :ref:`🔗<class_CameraFeed_method_set_format>`
  206. 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:
  207. \ ``separate`` will result in FEED_YCBCR_SEP
  208. \ ``grayscale`` will result in desaturated FEED_RGB
  209. \ ``copy`` will result in FEED_YCBCR
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_CameraFeed_method_set_name:
  213. .. rst-class:: classref-method
  214. |void| **set_name**\ (\ name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_CameraFeed_method_set_name>`
  215. Sets the camera's name.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_CameraFeed_method_set_position:
  219. .. rst-class:: classref-method
  220. |void| **set_position**\ (\ position\: :ref:`FeedPosition<enum_CameraFeed_FeedPosition>`\ ) :ref:`🔗<class_CameraFeed_method_set_position>`
  221. Sets the position of this camera.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_CameraFeed_method_set_rgb_image:
  225. .. rst-class:: classref-method
  226. |void| **set_rgb_image**\ (\ rgb_image\: :ref:`Image<class_Image>`\ ) :ref:`🔗<class_CameraFeed_method_set_rgb_image>`
  227. Sets RGB image for this feed.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_CameraFeed_method_set_ycbcr_image:
  231. .. rst-class:: classref-method
  232. |void| **set_ycbcr_image**\ (\ ycbcr_image\: :ref:`Image<class_Image>`\ ) :ref:`🔗<class_CameraFeed_method_set_ycbcr_image>`
  233. Sets YCbCr image for this feed.
  234. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  235. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  236. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  237. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  238. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  239. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  240. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  241. .. |void| replace:: :abbr:`void (No return value.)`