> 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/getting-started/your-very-first-project/detection.md).

# Detection

In this part, you will detect the golf ball position. You will first build a simple detector, then fix the reference so detection remains stable while the ball moves.

{% stepper %}
{% step %}

### Add Find Object

Go to the blocks bar. Under **Detections/Shapes**, open **Detectors** and drag **Find Object** into the scenario.

![](/files/Kz4QLPQfKYIagoHV4o8l)
{% endstep %}

{% step %}

### Add Show Image

Under **Input/Output**, open **Outputs/Exports** and drag **Show Image** into the scenario.

![](/files/zX2iS0cVeD4zdf9dXU9f)
{% endstep %}

{% step %}

### Connect the detector

Connect the blocks as shown below.

![](/files/n5HxQ6M0usu4qzTkSGPO)

Click <img src="/files/YAlVdoT2RjcfaRrTpP2p" alt="run step" data-size="line">*Run Step*. You should see the detected golf ball inside a red box in **Show Image**.

![](/files/O3oxWYKSjOQuxxgaxJ5d)
{% endstep %}

{% step %}

### Test continuous detection

Click <img src="/files/dEBSnHPh0rec7YKCQ54r" alt="run" data-size="line"> *Run* and watch the detection for about 10 seconds.

You may notice that detection becomes unstable. This happens because **Image ROI Select** keeps changing its reference as the ball moves, so the reference can become grass instead of the golf ball.
{% endstep %}

{% step %}

### Add Image Memory

To keep the reference stable, add **Image Memory**.

Go to the blocks bar. Under **Image Transformers**, open **Analysis** and drag **Image Memory** into the scenario.

![](/files/ZzwOo9oqAEL4EzPn4KPC)
{% endstep %}

{% step %}

### Add Logic Input

Under **Input/Output**, open **Data Inputs** and drag **Logic Input** into the scenario.

![](/files/9TZNPwBGATbeyEyblfhp)
{% endstep %}

{% step %}

### Rearrange crowded blocks

Move one block by clicking and dragging it.

![](/files/nyfAfYurtXQQzUbMUzAT)

Move multiple blocks by dragging a selection around them, then dragging the selected group.

![](/files/PXcgQO2dF19IAwcn6fnG)
{% endstep %}

{% step %}

### Connect Image Memory

Connect the new blocks as shown below.

![](/files/BgXCybBF5VZe4QJwTkCd)

**Image Memory** freezes the frame we need, so the reference does not change while the video runs.
{% endstep %}

{% step %}

### Save the reference frame

Run the scenario for one step. Then set **Logic Input** to **True** to save the image in **Image Memory**.

![](/files/B6z6NXne558KiqHtAYaL)
{% endstep %}

{% step %}

### Tune Find Object

Move to **Find Object** and set **Match Threshold** to `100%`.

<figure><img src="/files/C9Sq35pcXx6HnCEdLGFC" alt="Find Object match threshold" width="450"><figcaption><p>Find Object match threshold</p></figcaption></figure>
{% endstep %}

{% step %}

### Run detection

Press *Run* and check that the detector follows the golf ball.

![](/files/usmdy4wtqn8nffSNmxyt)
{% endstep %}
{% endstepper %}

The detector is now working with a stable reference. Continue to the final page to check whether the golf ball reaches the hole.
