Table of Contents

Create a target image (Target)

To ensure the stability and accuracy of AR recognition, we recommend uploading images with rich texture, obvious feature points, and no blurred areas.

Before starting integration, note the following core principles:

  • Prioritize quality: avoid uploading images with low contrast or sparse texture.
  • Avoid conflicts: do not upload multiple images with highly similar content. Although EasyAR CRS returns the best-matching result, similar images can reduce recognition confidence or cause unexpected jumps.

In the initial verification phase, you can create target images by using the add directly through EasyAR Web method.

The API for creating target images is: API - Create target image.

In production, it is not recommended to upload target images directly through EasyAR Web upload or by directly calling API - Create target image.

We recommend referring to the best practices for creating target images method to create target images.

Best practices for creating target images

In production environments, we strongly recommend that developers follow the following three-step method to manage target images automatically through APIs instead of forcibly uploading them directly.

Step 1: Check similar/conflicting target images

Before officially adding a target, first check whether the current image library already contains the same or extremely similar targets.

  • Tool: use the similarity check API (similar).
  • Handling logic: if the API returns an existing targetId, we recommend evaluating whether you need to overwrite it, delete the old image, or disable the conflicting item to ensure uniqueness in the recognition logic.

Step 2: Recognition difficulty rating precheck

Use the algorithm to predict whether the image is suitable as a recognition target image.

Step 3: Officially upload the target image

After passing the two checks above, you can safely perform the upload operation.

Manual management through EasyAR Web

This applies to the verification phase or to maintaining a small number of target images. The Web management console uses a "force create" mode and does not automatically perform similarity checks or validate image recognizability.

Operation steps:

  1. Log in to EasyAR Developer Center -> Cloud recognition management -> select an image library -> click Manage.
  2. Click Upload target image in the interface.

Web creation guide

  1. Key parameter configuration:
    • Name: identifier of the recognition image.
    • Width: enter the actual size of the image in the physical world. This determines the initial scale of AR content rendered by clients such as Unity after recognition.
    • Meta: stores URLs, model paths, or JSON configurations associated with the image. The data must be Base64 encoded before upload.

Parameter filling example

Use the API to create automatically

For large-scale management or integration into your own backend, use the Web Service REST API for automated creation.

API reference: Create target image API

Preparation checklist

Before initiating the request, make sure you have obtained the following resources (see API call preparation checklist for details):

  • CRS AppId
  • API Key / Secret or Token
  • Server-end URL (target management entry, HTTPS port 443)
  • Test image (supports JPEG/PNG format and must be converted to a Base64 string)
  • First convert the local target image to Base64 (macOS / Linux), and save the result to image_base64.txt.
base64 -i ./target.jpg | tr -d '\n' > image_base64.txt
  • Replace the placeholders with actual parameters and run the curl script.
    • Your-Server-side-URL -> actual API host
    • Your-Token -> actual API Key Authorization Token
    • Your-CRS-AppId -> your appId
    • demo_target -> target name
    • size -> target image width (cm)
curl -X POST "https://<Your-Server-side-URL>/targets" \
  -H "Content-Type: application/json" \
  -H "Authorization: <YOUR-TOKEN>" \
  -d '{
    "appId": "<Your-CRS-AppId>",
    "image": "'"$(cat image_base64.txt)"'",
    "active": "1",
    "name": "demo_target",
    "size": "20",
    "type": "ImageTarget",
    "allowSimilar": "1"
  }'

Related topics:

Next topic: