> For the complete documentation index, see [llms.txt](https://ms-kb.msd.unimelb.edu.au/next-lab/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ms-kb.msd.unimelb.edu.au/next-lab/augmented-reality/guides/unity-and-vuforia-1/2d-targets.md).

# 2D Targets (Image Targets)

## Image Targets

**Image Targets** refer to **2D images** which Vuforia can **recognise** and **track**. These image targets work in a similar way to QR codes, but **full colour images can be used**.

![Figure 0.0 - Image Targets in Augmented Reality](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYjGne3t9ubv2_BnC2D%2F-LYjGz7GfmYSNZgXSWYy%2FAr-2.gif?alt=media\&token=2844d107-64b0-488c-9e61-9ae5d3e1ee0d)

### Image Requirements

The **Vuforia Target Manager supports** `.jpg` and `.png` images that are 2 MB or smaller. These images can be RGB or Grayscale. The **features** of the **image** are **graded** based on how well the engine is able to **track** them. Learn more [here](https://library.vuforia.com/articles/Solution/Optimizing-Target-Detection-and-Tracking-Stability): &#x20;

{% embed url="<https://library.vuforia.com/articles/Solution/Optimizing-Target-Detection-and-Tracking-Stability>" %}

### Workflow

The **basic workflow** for working with **Image Targets** is as follows:

1. Upload the image to the **Vuforia Target Manage**r online. You can also use one of the sample Image Targets.
2. Download the updated **Target Manager Database**.
3. **Add the image target** to your project in **Unity**
   1. **Add the Device Database**
   2. **Add and Configure the Image Target** as a GameObject
      1. Add an `ARCamera`
      2. Add an `ImageTarget`
      3. Assign Content to the `ImageTarget`

## Image Recognition in Unity

The basic workflow within Unity is **extremely similar** to that of [3D (Object) Targets](/next-lab/augmented-reality/guides/unity-and-vuforia-1/3d-targets.md).&#x20;

### Add a Device Database

If you haven't already, download the device database from your **Vuforia Target Manager**.&#x20;

**Import** the `.unitypackage` file by heading to `Asset > Import Package`

See: [Device Databases](/next-lab/augmented-reality/guides/unity-and-vuforia-1/vuforia-primer.md#4-0-preparing-the-unity-scene)

{% embed url="<https://msd-makerspaces.gitbook.io/next-lab/~/edit/drafts/-LYUgGPg6IbMnzsfVph2/augmented-reality/guides/unity-and-vuforia-1/vuforia-primer#4-0-preparing-the-unity-scene>" %}

### Add and Configure the GameObject

1. Add an `ARCamera` instance to your **scene**. \
   `GameObject > Vuforia > ARCamera`
2. [**Generate and add your license** ](/next-lab/augmented-reality/guides/unity-and-vuforia-1/vuforia-primer.md#4-3-1-adding-a-license-key)information to the `ARCamera` in the **Inspector Window**
3. Add an `ImageTarget` instance to your scene.\
   ~~`GameObject > Vuforia > 3D Scan`~~
4. **Change the Image Target Behaviour**. With the `ImageTarget` selected, change the `Type`, `Database` and `Image Target` fields in the **Inspector Window**

![Figure 1.2 - Image Target Behaviour](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYe2NGWAbYKSZ89i0l1%2F-LYe4FTY9kE7L5Kp8h7R%2FScreen%20Shot%202019-02-13%20at%203.30.56%20pm.png?alt=media\&token=e8eca47d-0e93-41ae-b514-11ccbfa77bf9)

### Add Content to the GameObject

1. Add any **content** you desire to augment the image. This can be **2d content** such as text or **3d assets** such as `.FBX` files.\
   In this case, we have named our content **Cube**.
2. Make the **content** a **child** of the `ImageTarget`. This way the **content** will **only be displayed** once the `ImageTarget` is **recongnised**.<br>

![Figure 1.3 - Using the Hierarchy Window](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYe2NGWAbYKSZ89i0l1%2F-LYe4AcmB0DnxUlEalXz%2FHierarchy.png?alt=media\&token=7f59ad8a-e20d-457d-ac71-3c24de5ed7f1)

## Testing Outcomes

**Use the Play button** in the `toolbar` to **test the application**.

![Figure 2.0 - Testing outcomes using the Debug Feature](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYdq2tYANFqDcsLvtUc%2F-LYdq9hM3DF9H0CoeBAq%2Far_demo_video_1.gif?alt=media\&token=cde00828-1e58-4228-b7ee-8e3650c5dc19)
