Table of Contents

Creating target images (Target)

To ensure the stability and accuracy of AR recognition, it is recommended that you upload images with rich textures, distinct feature points, and no blurry areas.

Before starting integration, please note the following core principles:

  • Quality first: Avoid uploading images with low contrast or sparse textures.
  • Avoid conflicts: Do not upload multiple images with highly similar content. Although EasyAR CRS will return the best match, similar images can lead to decreased confidence in recognition results or unexpected jumps.

The verification phase can be started by creating target images directly through the EasyAR Web adding method.

The API interface for creating target images is: API — Create target image.

It is not recommended to upload target images directly through EasyAR Web or by directly calling the API — Create target image in production.

It is recommended to create target images by referring to the Best practices for creating target images method.

Best practices for creating target images

In a production environment, we strongly recommend that developers follow the following three-step method to manage target images automatically through APIs, rather than directly forcing uploads.

Step 1: Check for similar/conflicting target images

Before formally adding, check whether the same or extremely similar targets already exist in the current image library.

  • Tool: Use the Similarity check API (similar).
  • Processing logic: If the API returns an existing targetId, it is recommended that you evaluate whether to overwrite, delete the old image, or deactivate conflicting items to ensure the uniqueness of the recognition logic.

Step 2: Recognition difficulty rating pre-check

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

Step 3: Formal upload of target images

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

Manual management through EasyAR Web

Suitable for the verification phase or maintaining a small number of target images. The Web management end adopts a "forced creation" mode, which does not automatically perform similarity checks, nor does it check the recognizability of images.

Steps:

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

Web creation guide

  1. Key parameter configuration:
    • Name: The identifier of the recognition image.
    • Width: Enter the actual size of the image in the physical world. This determines the initial scale for rendering AR content in clients such as Unity after recognition.
    • Meta: Store the URL, model path, or JSON configuration associated with this image. The data must be Base64-encoded before uploading.

Parameter filling example

Creating automatically using APIs

For large-scale management or integration into your own backend, use the Web Service REST API to create automatically.

API interface reference Create target image API

Preparation checklist

Before initiating the request, please ensure to obtain the following resources (details in API call preparation checklist):

  • CRS AppId
  • API Key / Secret or Token
  • Server-end URL (target management entry, port 443 for https)
  • Test image (supports JPEG/PNG format, needs to be converted to a Base64 string)
  • First, convert the local target image to Base64 (macOS / Linux) and store the result in image_base64.txt
base64 -i ./target.jpg | tr -d '\n' > image_base64.txt  
  • Replace placeholders with actual parameters and execute 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: