| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="CameraFeed" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | A camera feed gives you access to a single physical camera attached to your device. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | 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]. |
| 8 | [b]Note:[/b] 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. |
| 9 | [b]Note:[/b] This class is currently only implemented on Linux, Android, macOS, and iOS. On other platforms no [CameraFeed]s will be available. To get a [CameraFeed] on iOS, the camera plugin from [url=https://github.com/godotengine/godot-ios-plugins]godot-ios-plugins[/url] is required. |
| 10 | </description> |
| 11 | <tutorials> |
| 12 | </tutorials> |
| 13 | <methods> |
| 14 | <method name="_activate_feed" qualifiers="virtual"> |
| 15 | <return type="bool" /> |
| 16 | <description> |
| 17 | Called when the camera feed is activated. |
| 18 | </description> |
| 19 | </method> |
| 20 | <method name="_deactivate_feed" qualifiers="virtual"> |
| 21 | <return type="void" /> |
| 22 | <description> |
| 23 | Called when the camera feed is deactivated. |
| 24 | </description> |
| 25 | </method> |
| 26 | <method name="get_datatype" qualifiers="const"> |
| 27 | <return type="int" enum="CameraFeed.FeedDataType" /> |
| 28 | <description> |
| 29 | Returns feed image data type. |
| 30 | </description> |
| 31 | </method> |
| 32 | <method name="get_id" qualifiers="const"> |
| 33 | <return type="int" /> |
| 34 | <description> |
| 35 | Returns the unique ID for this feed. |
| 36 | </description> |
| 37 | </method> |
| 38 | <method name="get_name" qualifiers="const"> |
| 39 | <return type="String" /> |
| 40 | <description> |
| 41 | Returns the camera's name. |
| 42 | </description> |
| 43 | </method> |
| 44 | <method name="get_position" qualifiers="const"> |
| 45 | <return type="int" enum="CameraFeed.FeedPosition" /> |
| 46 | <description> |
| 47 | Returns the position of camera on the device. |
| 48 | </description> |
| 49 | </method> |
| 50 | <method name="get_texture_tex_id"> |
| 51 | <return type="int" /> |
| 52 | <param index="0" name="feed_image_type" type="int" enum="CameraServer.FeedImage" /> |
| 53 | <description> |
| 54 | Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data). |
| 55 | </description> |
| 56 | </method> |
| 57 | <method name="set_external"> |
| 58 | <return type="void" /> |
| 59 | <param index="0" name="width" type="int" /> |
| 60 | <param index="1" name="height" type="int" /> |
| 61 | <description> |
| 62 | Sets the feed as external feed provided by another library. |
| 63 | </description> |
| 64 | </method> |
| 65 | <method name="set_format"> |
| 66 | <return type="bool" /> |
| 67 | <param index="0" name="index" type="int" /> |
| 68 | <param index="1" name="parameters" type="Dictionary" /> |
| 69 | <description> |
| 70 | Sets the feed format parameters for the given [param index] in the [member formats] array. Returns [code]true[/code] on success. By default, the YUYV encoded stream is transformed to [constant FEED_RGB]. The YUYV encoded stream output format can be changed by setting [param parameters]'s [code]output[/code] entry to one of the following: |
| 71 | - [code]"separate"[/code] will result in [constant FEED_YCBCR_SEP]; |
| 72 | - [code]"grayscale"[/code] will result in desaturated [constant FEED_RGB]; |
| 73 | - [code]"copy"[/code] will result in [constant FEED_YCBCR]. |
| 74 | </description> |
| 75 | </method> |
| 76 | <method name="set_name"> |
| 77 | <return type="void" /> |
| 78 | <param index="0" name="name" type="String" /> |
| 79 | <description> |
| 80 | Sets the camera's name. |
| 81 | </description> |
| 82 | </method> |
| 83 | <method name="set_position"> |
| 84 | <return type="void" /> |
| 85 | <param index="0" name="position" type="int" enum="CameraFeed.FeedPosition" /> |
| 86 | <description> |
| 87 | Sets the position of this camera. |
| 88 | </description> |
| 89 | </method> |
| 90 | <method name="set_rgb_image"> |
| 91 | <return type="void" /> |
| 92 | <param index="0" name="rgb_image" type="Image" /> |
| 93 | <description> |
| 94 | Sets RGB image for this feed. |
| 95 | </description> |
| 96 | </method> |
| 97 | <method name="set_ycbcr_image"> |
| 98 | <return type="void" /> |
| 99 | <param index="0" name="ycbcr_image" type="Image" /> |
| 100 | <description> |
| 101 | Sets YCbCr image for this feed. |
| 102 | </description> |
| 103 | </method> |
| 104 | <method name="set_ycbcr_images"> |
| 105 | <return type="void" /> |
| 106 | <param index="0" name="y_image" type="Image" /> |
| 107 | <param index="1" name="cbcr_image" type="Image" /> |
| 108 | <description> |
| 109 | Sets Y and CbCr images for this feed. |
| 110 | </description> |
| 111 | </method> |
| 112 | </methods> |
| 113 | <members> |
| 114 | <member name="feed_is_active" type="bool" setter="set_active" getter="is_active" default="false"> |
| 115 | If [code]true[/code], the feed is active. |
| 116 | </member> |
| 117 | <member name="feed_transform" type="Transform2D" setter="set_transform" getter="get_transform" default="Transform2D(1, 0, 0, -1, 0, 1)"> |
| 118 | The transform applied to the camera's image. |
| 119 | </member> |
| 120 | <member name="formats" type="Array" setter="" getter="get_formats" default="[]"> |
| 121 | Formats supported by the feed. Each entry is a [Dictionary] describing format parameters. |
| 122 | </member> |
| 123 | </members> |
| 124 | <signals> |
| 125 | <signal name="format_changed"> |
| 126 | <description> |
| 127 | Emitted when the format has changed. |
| 128 | </description> |
| 129 | </signal> |
| 130 | <signal name="frame_changed"> |
| 131 | <description> |
| 132 | Emitted when a new frame is available. |
| 133 | </description> |
| 134 | </signal> |
| 135 | </signals> |
| 136 | <constants> |
| 137 | <constant name="FEED_NOIMAGE" value="0" enum="FeedDataType"> |
| 138 | No image set for the feed. |
| 139 | </constant> |
| 140 | <constant name="FEED_RGB" value="1" enum="FeedDataType"> |
| 141 | Feed supplies RGB images. |
| 142 | </constant> |
| 143 | <constant name="FEED_YCBCR" value="2" enum="FeedDataType"> |
| 144 | Feed supplies YCbCr images that need to be converted to RGB. |
| 145 | </constant> |
| 146 | <constant name="FEED_YCBCR_SEP" value="3" enum="FeedDataType"> |
| 147 | Feed supplies separate Y and CbCr images that need to be combined and converted to RGB. |
| 148 | </constant> |
| 149 | <constant name="FEED_EXTERNAL" value="4" enum="FeedDataType"> |
| 150 | Feed supplies external image. |
| 151 | </constant> |
| 152 | <constant name="FEED_UNSPECIFIED" value="0" enum="FeedPosition"> |
| 153 | Unspecified position. |
| 154 | </constant> |
| 155 | <constant name="FEED_FRONT" value="1" enum="FeedPosition"> |
| 156 | Camera is mounted at the front of the device. |
| 157 | </constant> |
| 158 | <constant name="FEED_BACK" value="2" enum="FeedPosition"> |
| 159 | Camera is mounted at the back of the device. |
| 160 | </constant> |
| 161 | </constants> |
| 162 | </class> |