# Image Memory

This function block keeps an image in memory so you can "freeze" a frame and reuse it until you choose to update it. It is useful when you want to hold a reference image for inspection, logging or downstream processing without continuously relying on a live source.

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

* `Image Any` Connect the image you want to store or update.
* `Save Image` When True the block will keep (freeze) the currently stored image and will not update it from the input.

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

* `Image Any` The image currently held in memory (either the last stored image or the live input when not frozen).

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

* `Save Image` Use this boolean control to freeze or unfreeze the stored image.
  * When set to True the stored image is preserved and the block will keep outputting that image even if the input changes.
  * When set to False the block updates its stored image from the `Image Any` input.

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

* By default the block outputs the latest image connected to its `Image Any` input.
* If `Save Image` is set to True, the block will hold the current image and continue to output that same image until `Save Image` becomes False.
* When you save and reload your project, the block can restore the stored image so the memory state persists across sessions (if an image was stored).

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

* Freeze-frame capability for consistent downstream processing.
* Simple boolean control to lock/unlock the stored image.
* Persistence across project save/load so a captured reference image can be kept between sessions.

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

1. Connect a live image source (camera, stream, load image, etc.) to the `Image Any` input.
2. To capture and hold a frame, set `Save Image` to True. The block will keep outputting that frame.
3. To resume live updates, set `Save Image` to False. The block will then copy the latest input and continue updating its stored image.

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

* To preview the stored image, connect this block's output to `Show Image`.
* Use `Image ROI Select` before this block to capture and freeze only a region of interest instead of the whole frame.
* If you want a smaller image for faster storage or downstream processing, add `Image Resize` before the block.
* For more robust reference images, apply `Blur` or `Image Threshold` before capturing to reduce noise or binarize the scene.
* Combine with `Image Logger` or `Image Write` to save frozen images to disk when `Save Image` is activated.
* Use `Is None` or `Replace None` downstream to guard against missing images in your flow.

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

* If the output appears empty after loading a project, ensure an image was previously captured with `Save Image` enabled or provide a fresh input image and set `Save Image` to False to update.
* If you expect live updates but the image is not changing, check that `Save Image` is set to False so the block is allowed to refresh from the input.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/image-transformations/analysis/image-memory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
