Table of Contents

Creating target image (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 low-contrast or texture-sparse images.
  • Avoid conflicts: Do not upload multiple images with highly similar content. Although EasyAR CRS will return the most matching result, similar images may cause decreased confidence in recognition results or unexpected switching.

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.

Directly uploading target images via EasyAR Web or directly calling the API - Create Target Image is not recommended for production.

It is recommended to refer to the best practices for creating target images method.

Create target graph best practices

In production environments, we strongly recommend that developers follow the three-step approach below to manage target graphs through API automation, rather than force uploading directly.

Step 1: check for similar/conflicting target images

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

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

Step two: identify difficulty rating pre-check

Utilize algorithms to predict whether an image is suitable as a target image.

Step 3: formally upload the target image

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

Manual management via EasyAR Web

Suitable for verification phases or maintaining a small number of target images. The web management interface adopts a "forced creation" mode, which does not automatically perform similarity checks nor validate image recognizability.

Steps:

  1. Log in to EasyAR Developer Center -> Cloud recognition management -> select 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 physical dimensions of the image in the real world. This determines the initial scale for rendering AR content in clients like Unity after recognition.
    • Meta: Stores the URL, model path, or JSON configuration associated with this image. Data must be Base64-encoded before uploading.

Parameter example

Using API automation to create

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

API interface refer to Create Target Image API

Preparation list

Before initiating the request, ensure you have obtained the following resources (refer to API call preparation checklist):

  • CRS AppId
  • API Key / Secret or Token
  • Server-end URL (target management entry, HTTPS port 443)
  • Test image (supports JPEG/PNG format, must be converted to 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
  • Please 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: