Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/components/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ ESPHome to cellular networks. **Does not encompass Wi-Fi.**

{{< imgtable >}}
"Camera Encoder","components/camera/camera_encoder","camera.svg","dark-invert"
"Camera Sensor","components/camera/camera_sensor","camera.svg","dark-invert"
"ESP32 Camera","components/esp32_camera","camera.svg","dark-invert"
"Exposure Notifications","components/exposure_notifications","exposure_notifications.png",""
"GPS","components/gps","crosshairs-gps.svg","dark-invert"
Expand Down
57 changes: 57 additions & 0 deletions content/components/camera/camera_sensor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
description: "Instructions for setting up the camera_sensor component in ESPHome."
title: "Camera Sensor"
params:
seo:
description: Instructions for setting up the camera_sensor component in ESPHome.
image: camera.svg
---

The ``camera_sensor`` component represents the first stage in the camera pipeline in ESPHome.
It provides a unified interface for camera sensor implementations, allowing both software
and hardware sensors to produce images for the rest of the camera pipeline.

ESPHome includes an initial software-based camera sensor which can be used for testing,
visualization of data, thermal cameras, or situations where no physical camera is available.

```yaml
# Example configuration entry
camera_sensor:
type: software
width: 256
height: 256
image_format: RGB565
```

## Configuration variables

- **type** (*Optional*): ``software``

## Software Options

- **width** (**Required**, int): Width of the generated image.
- **height** (**Required**, int): Height of the generated image.
- **format** (**Required**, enum): Pixel format of the image. Options are:
- ``GRAYSCALE``: Each pixel is one byte representing grayscale values.
- ``RGB565``: Two bytes per pixel, encoded as 5-6-5 for red, green, and blue.
{{< note >}}
When combining camera sensors with encoders, it may be necessary to perform little-endian to big-endian
transformations. This can easily be spotted if not only red and blue are swapped but also some static
appears in the image.
{{< /note >}}
- ``BGR888``: Three bytes per pixel; the first byte is blue, followed by green and red.

- **buffer** (*Optional*, int): Number of allocated frame buffers. Using 2 framebuffers allows
the pipeline to start processing of the second buffer before the first one is entirely completed,
which can slightly improve throughput.
Valid values: ``1``–``2``. Default: ``1``.

- **clear** (*Optional*, boolean): If the framebuffer should be cleared to zeros before processing
starts. This can be convenient to avoid manual clearing via automations; however,
skipping this can save time if the entire framebuffer is written anyway.
- Default: ``True``.

## See Also

- {{< apiref "camera/sensor.h" "camera/sensor.h" >}}
- {{< apiref "camera_sensor/software_sensor.h" "camera_sensor/software_sensor.h" >}}