|
| 1 | +--- |
| 2 | +description: "Instructions for setting up the camera_sensor component in ESPHome." |
| 3 | +title: "Camera Sensor" |
| 4 | +params: |
| 5 | + seo: |
| 6 | + description: Instructions for setting up the camera_sensor component in ESPHome. |
| 7 | + image: camera.svg |
| 8 | +--- |
| 9 | + |
| 10 | +The ``camera_sensor`` component represents the first stage in the camera pipeline in ESPHome. |
| 11 | +It provides a unified interface for camera sensor implementations, allowing both software |
| 12 | +and hardware sensors to produce images for the rest of the camera pipeline. |
| 13 | + |
| 14 | +ESPHome includes an initial software-based camera sensor which can be used for testing, |
| 15 | +visualization of data, thermal cameras, or situations where no physical camera is available. |
| 16 | + |
| 17 | +```yaml |
| 18 | +# Example configuration entry |
| 19 | +camera_sensor: |
| 20 | + type: software |
| 21 | + width: 256 |
| 22 | + height: 256 |
| 23 | + image_format: RGB565 |
| 24 | +``` |
| 25 | +
|
| 26 | +## Configuration variables |
| 27 | +
|
| 28 | +- **type** (*Optional*): ``software`` |
| 29 | +
|
| 30 | +## Software Options |
| 31 | +
|
| 32 | +- **width** (**Required**, int): Width of the generated image. |
| 33 | +- **height** (**Required**, int): Height of the generated image. |
| 34 | +- **format** (**Required**, enum): Pixel format of the image. Options are: |
| 35 | + - ``GRAYSCALE``: Each pixel is one byte representing grayscale values. |
| 36 | + - ``RGB565``: Two bytes per pixel, encoded as 5-6-5 for red, green, and blue. |
| 37 | +{{< note >}} |
| 38 | +When combining camera sensors with encoders, it may be necessary to perform little-endian to big-endian |
| 39 | +transformations. This can easily be spotted if not only red and blue are swapped but also some static |
| 40 | +appears in the image. |
| 41 | +{{< /note >}} |
| 42 | + - ``BGR888``: Three bytes per pixel; the first byte is blue, followed by green and red. |
| 43 | +
|
| 44 | +- **buffer** (*Optional*, int): Number of allocated frame buffers. Using 2 framebuffers allows |
| 45 | + the pipeline to start processing of the second buffer before the first one is entirely completed, |
| 46 | + which can slightly improve throughput. |
| 47 | + Valid values: ``1``–``2``. Default: ``1``. |
| 48 | +
|
| 49 | +- **clear** (*Optional*, boolean): If the framebuffer should be cleared to zeros before processing |
| 50 | + starts. This can be convenient to avoid manual clearing via automations; however, |
| 51 | + skipping this can save time if the entire framebuffer is written anyway. |
| 52 | + - Default: ``True``. |
| 53 | +
|
| 54 | +## See Also |
| 55 | +
|
| 56 | +- {{< apiref "camera/sensor.h" "camera/sensor.h" >}} |
| 57 | +- {{< apiref "camera_sensor/software_sensor.h" "camera_sensor/software_sensor.h" >}} |
0 commit comments