> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/image-transformations/transformation-filters/heatmap.md).

# HeatMap

This function block visualizes where motion accumulates over time in a fixed field of view. It creates a color overlay showing areas with frequent movement, useful for surveillance, traffic analysis, or activity heatmapping.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Image Any` Grayscale or color image stream to analyze for motion.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Image Any` Color image with a heatmap overlay that highlights areas with frequent motion.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Threshold` Adjusts the sensitivity for foreground detection. Higher values make the block ignore small changes and focus on stronger motion.

`MaxValue` Controls how much each detected motion event adds to the accumulated heatmap. Larger values increase the contribution of each event.

`Alpha` Controls the weight of the original first frame when overlaying the color heatmap. Lower values make the overlay stronger.

`Beta` Controls the weight of the colorized accumulated motion map when overlaying. Higher values make the heatmap more prominent.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

* On first run the block captures and preserves the first frame as a background reference.
* For subsequent frames it computes foreground pixels and thresholds them to detect motion events.
* Detected motion pixels are accumulated into a single internal image over time.
* The accumulated image is colorized and blended with the preserved first frame using the `Alpha` and `Beta` controls to produce the final overlay.
* The block continues accumulating until the run is stopped or the block is reset.

## 🎯 Features <a href="#features" id="features"></a>

* Continuous accumulation for long-term motion heatmaps.
* Simple control set for balancing sensitivity and visualization strength.
* Real-time overlay to see where most activity occurs in the scene.
* Built-in hard reset handling to clear accumulated data between runs.

## 📝 Usage instructions <a href="#usage" id="usage"></a>

1. Feed a live camera or video frame stream into the `Image Any` input.
2. Tune `Threshold` to focus on meaningful motion and ignore noise.
3. Adjust `MaxValue` to set how strongly each event contributes to the heatmap.
4. Use `Alpha` and `Beta` to balance visibility between the original scene and the colorized heatmap.
5. Stop or reset the run when you want to clear the accumulated heatmap.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* For live camera sources, pair this block with `Camera USB`, `Camera IP (ONVIF)`, or `Stream Reader` to feed continuous frames.
* If your input frames are large and you only need an overview, add `Image Resize` before this block to reduce processing and speed up accumulation.
* To focus on a specific region, crop with `Image ROI` or `Image ROI Select` before feeding frames into this block.
* If you want a separate foreground mask or additional background models, try combining with `Background Subtractor` for alternative foreground detection prior to accumulation.
* Use `Show Image` to preview the overlay live in the UI.
* Save results periodically with `Image Logger` or record sessions with `Record Video` for post-analysis.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* If the heatmap shows too much noise, increase `Threshold` and consider preprocessing with `Blur` or `Denoising`.
* If motion areas grow too quickly, lower `MaxValue` or periodically reset the run to clear old accumulation.
* If the overlay is too faint or too strong, adjust `Alpha` and `Beta` to achieve the desired visual balance.
* If no motion is detected, verify the input frames are changing and are not identical; try feeding a live camera source like `Camera USB` to confirm operation.
