# ARTrackedImageExtensions

Extensions to AR Foundation's`ARTrackedImage`class.

## Summary

|                                                                                                                                                                                                                                                              ### Public static functions                                                                                                                                                                                                                                                              ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [IsMarker](https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/ARTrackedImageExtensions#ismarker)`(this ARTrackedImage image)`                                                                                                                                                                                | `bool` Check if the given image is a marker.                                                                                                                                                           |
| [IsQrCode](https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/ARTrackedImageExtensions#isqrcode)`(this ARTrackedImage image)`                                                                                                                                                                                | `bool` Check if the give image is a QR code.                                                                                                                                                           |
| [TryGetMarkerData](https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/ARTrackedImageExtensions#trygetmarkerdata)`(this ARTrackedImage image, out `[XRMarkerDictionary](https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrmarkerdictionary)` dictionary, out int id)` | `bool` Try to get the[XRMarkerDictionary](https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrmarkerdictionary)and the id from the dictionary of a marker image. |
| [TryGetQrCodeData](https://developer.android.com/develop/xr/unity/reference/class/Google/XR/Extensions/ARTrackedImageExtensions#trygetqrcodedata)`(this ARTrackedImage image, out string decodedData)`                                                                                                                                        | `bool` Try to get the decoded data from a QR code image.                                                                                                                                               |

## Public static functions

### IsMarker

```c#
bool IsMarker(
  this ARTrackedImage image
)
```  
Check if the given image is a marker.

<br />

|                                              Details                                               ||
|-------------|---------------------------------------------------------------------------------------|
| Parameters  | |---------|------------------------------| | `image` | The ARTrackedImage instance. | |
| **Returns** | `true`, if it's a valid marker image.                                                 |

### IsQrCode

```c#
bool IsQrCode(
  this ARTrackedImage image
)
```  
Check if the give image is a QR code.

<br />

|                                              Details                                               ||
|-------------|---------------------------------------------------------------------------------------|
| Parameters  | |---------|------------------------------| | `image` | The ARTrackedImage instance. | |
| **Returns** | `true`, if it's a valid QR code image.                                                |

### TryGetMarkerData

```c#
bool TryGetMarkerData(
  this ARTrackedImage image,
  out XRMarkerDictionary dictionary,
  out int id
)
```  
Try to get the[XRMarkerDictionary](https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrmarkerdictionary)and the id from the dictionary of a marker image.

<br />

|                                                                                                                                                                                                                                                                                                                                             Details                                                                                                                                                                                                                                                                                                                                              ||
|-------------| |
| Parameters  | |--------------|---------------------------------------------------------------------------------------------------------------------------------------------------| | `image`      | The marker ARTrackedImage image instance which returns`true`from IsMarker(ARTrackedImage).                                                        | | `dictionary` | The[XRMarkerDictionary](https://developer.android.com/develop/xr/unity/reference/namespace/Google/XR/Extensions#xrmarkerdictionary)it belongs to. | | `id`         | The id from the*dictionary*.                                                                                                                      | |
| **Returns** | `true`if it gets marker data successfully and output by*dictionary* and*id*.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

### TryGetQrCodeData

```c#
bool TryGetQrCodeData(
  this ARTrackedImage image,
  out string decodedData
)
```  
Try to get the decoded data from a QR code image.

<br />

|                                                                                                                                                                           Details                                                                                                                                                                            ||
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Parameters  | |---------------|---------------------------------------------------------------------------------------------| | `image`       | The QR code ARTrackedImage image instance which returns`true`from IsQrCode(ARTrackedImage). | | `decodedData` | The decoded QR code data.                                                                   | |
| **Returns** | `true`, if it succeed to get QR Code data and*decodedData*contains valid data.                                                                                                                                                                                                                                                                  |

It can fail to get the data if the tracking server is still decoding or there is not data encoded with this QR code. You can try it again later if decoding finished.