class_camerafeed.rst 15 KB

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