### start
Source: https://www.easyar.com/doc/en/api/native/easyar.ObjectTracker.html
Starts the tracking algorithm.
```APIDOC
## POST /ObjectTracker/start
### Description
Initializes and starts the tracking algorithm.
### Method
POST
### Response
#### Success Response (200)
- **success** (Boolean) - Returns true if tracking started successfully.
```
--------------------------------
### Setup HTML Elements for Camera Preview
Source: https://www.easyar.com/doc/en/develop/web/cloud-recognition/guide.html
Defines the necessary HTML video and canvas elements required to stream and process camera input.
```html
```
--------------------------------
### Java SDK Example
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-grading.html?tabs=curl
Example of how to use the Java SDK to call the EasyAR Cloud Recognition Service for grade details, detection, and tracking.
```APIDOC
## Java SDK Example
### Description
This Java code snippet demonstrates how to integrate with the EasyAR Cloud Recognition Service. It covers setting up authentication, preparing the image, and making calls for grade details, detection, and tracking.
### Method
POST
### Endpoint
`/grade/detail`, `/grade/detection`, `/grade/tracking`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body (within the `grade` method)
- **image** (string) - Required - The target image file converted to Base64 format.
### Request Example (within `main` method)
```java
import okhttp3.*;
import org.json.JSONObject;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
public class Grade {
private static final String TARGET_MGMT_URL = "http://cn1.crs.easyar.com:8888";
private static final String CRS_APPID = "--here is your CRS AppId--";
private static final String API_KEY = "--here is your API Key--";
private static final String API_SECRET = "--here is your API Secret--";
private static final String IMAGE_PATH = "test_target_image.jpg";
enum GradeType {
DETAIL,
DETECTION,
TRACKING
}
private static final Map GRADE_URL = new HashMap(){
{
put(GradeType.DETAIL, "/grade/detail") ;
put(GradeType.DETECTION, "/grade/detection") ;
put(GradeType.TRACKING, "/grade/tracking") ;
}
};
public String grade(Auth auth, String imgPath, GradeType gradeType) throws IOException {
final Path mImagePath = Paths.get(imgPath);
JSONObject params = new JSONObject().put("image", Base64.getEncoder().encodeToString(
Files.readAllBytes(mImagePath)
));
Auth.signParam(params, auth.getAppId(), auth.getApiKey(), auth.getApiSecret());
RequestBody requestBody = FormBody.create(MediaType.parse("application/json; charset=utf-8")
, params.toString());
Request request = new Request.Builder()
.url(auth.getCloudURL() + GRADE_URL.get(gradeType))
.post(requestBody)
.build();
return new OkHttpClient.Builder().build().newCall(request).execute().body().string();
}
public static void main(String[] args) throws IOException {
Auth accessInfo = new Auth(CRS_APPID, API_KEY, API_SECRET, TARGET_MGMT_URL);
System.out.println("================== grade details ==================");
System.out.println(new Grade().grade(accessInfo, IMAGE_PATH, GradeType.DETAIL));
System.out.println("================== grade for detection ==================");
JSONObject gradeResp = new JSONObject(new Grade().grade(accessInfo, IMAGE_PATH, GradeType.DETECTION));
System.out.println("Detection grade: " + gradeResp.getJSONObject(Common.KEY_RESULT).get(Common.KEY_GRADE));
System.out.println("================== grade for tracking =================== ");
gradeResp = new JSONObject(new Grade().grade(accessInfo, IMAGE_PATH, GradeType.TRACKING));
System.out.println("Tracking grade: " + gradeResp.getJSONObject(Common.KEY_RESULT).get(Common.KEY_GRADE));
}
}
```
### Response
#### Success Response (200)
- **result** (object) - Contains the recognition results.
- **grade** (integer) - The calculated grade for the image.
#### Response Example
```json
{
"result": {
"grade": 95
}
}
```
```
--------------------------------
### cURL Example
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-grading.html?tabs=curl
Example of how to call the /grade/detail endpoint using cURL, including authentication and request body formatting.
```APIDOC
## cURL Example
### Description
This example demonstrates how to call the `/grade/detail` endpoint using cURL. It shows how to include the authorization token and the Base64 encoded image in the request body.
### Method
POST
### Endpoint
`https:///grade/detail`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **appId** (string) - Required - Your application ID for the CRS instance.
- **image** (string) - Required - The target image file converted to Base64 format.
### Request Example
```bash
curl -X POST "https:///grade/detail" \
-H "Content-Type: application/json" \
-H "Authorization: " \
-d '{
"appId": "",
"image": "'"$(cat image_base64.txt)"'"
}'
```
### Response
#### Success Response (200)
- **result** (object) - Contains the recognition results.
- **grade** (integer) - The calculated grade for the image.
#### Response Example
```json
{
"result": {
"grade": 95
}
}
```
```
--------------------------------
### NodeJS Example
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-grading.html?tabs=curl
Example of how to use the NodeJS script to call the EasyAR Cloud Recognition Service.
```APIDOC
## NodeJS Example
### Description
This example shows how to invoke the EasyAR Cloud Recognition Service using a NodeJS script. It requires configuring API keys and specifying the image file, server URL, and keys file path.
### Method
POST
### Endpoint
`/grade/detail` (implied by the script usage)
### Parameters
#### Path Parameters
- **image** (string) - Required - Path to the test image file (e.g., `test.jpeg`).
#### Query Parameters
- **-t** or **--host** (string) - Optional - The Server-end URL (default: `http://localhost:8888`).
- **-c** or **--keys** (string) - Optional - Path to the keys file (e.g., `keys.json`).
#### Request Body (handled by the script)
- **appId** (string) - Required - Your application ID for the CRS instance.
- **apiKey** (string) - Required - Your API Key.
- **apiSecret** (string) - Required - Your API Secret.
- **image** (string) - Required - The target image file converted to Base64 format.
### Request Example (Command Line)
```bash
node bin/grade test.jpeg -t -c keys.json
```
### Configuration File Example (`keys.json`)
```json
{
"appId": "--here is your appId for CRS Instance for SDK 4--",
"apiKey": "--here is your api key which is create from website and which has crs permission--",
"apiSecret": "--here is your api secret which is create from website--"
}
```
### Response
#### Success Response (200)
- **result** (object) - Contains the recognition results.
- **grade** (integer) - The calculated grade for the image.
#### Response Example
```json
{
"result": {
"grade": 95
}
}
```
```
--------------------------------
### start
Source: https://www.easyar.com/doc/en/api/native/easyar.XREALCameraDevice.html
Initiates the collection of video stream data from the camera.
```APIDOC
## POST /start
### Description
Starts collecting video stream data.
### Method
POST
### Endpoint
/start
### Parameters
#### Query Parameters
None
#### Request Body
None
### Response
#### Success Response (200)
- **success** (Boolean) - True if video stream collection started successfully, false otherwise.
#### Response Example
```json
{
"success": true
}
```
```
--------------------------------
### Start Camera Device
Source: https://www.easyar.com/doc/en/api/native/easyar.ARKitCameraDevice.html
Starts the collection of video stream data from the ARKit camera.
```c
bool easyar_ARKitCameraDevice_start(easyar_ARKitCameraDevice * This)
```
```cpp
bool start()
```
```java
public boolean start()
```
```kotlin
fun start(): Boolean
```
```objective-c
- (bool)start
```
```swift
public func start() -> Bool
```
```csharp
public virtual bool start()
```
--------------------------------
### Start Cloud Recognition Process
Source: https://www.easyar.com/doc/en/develop/web/cloud-recognition/sample.html
Initiates the cloud recognition process. This method typically takes a callback function that will be executed with the recognition results. It likely handles the continuous capture and sending of video frames for analysis.
```javascript
startRecognize(callback) {
}
```
--------------------------------
### Start Screen Recording (EasyAR Recorder)
Source: https://www.easyar.com/doc/en/api/native/easyar.Recorder.html
Starts the screen recording process. This method is available in C, C++, Java, Kotlin, Objective-C, Swift, and C#.
```c
void easyar_Recorder_start(easyar_Recorder * This)__
```
```cpp
void start()__
```
```java
public void start()__
```
```kotlin
fun start(): Unit__
```
```objective-c
- (void)start__
```
```swift
public func start() -> Void__
```
```csharp
public virtual void start()__
```
--------------------------------
### Install Python Requests Library
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-gallery.html
This command installs the 'requests' library, which is a popular HTTP library for Python, used for making API calls. It's a prerequisite for the Python script that interacts with the EasyAR service.
```bash
pip install requests
```
--------------------------------
### Python Image Recognition Setup
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-grading.html?tabs=curl
This section outlines the setup for running Python code for image recognition. It specifies the necessary library ('requests') and provides a placeholder for the Python script 'grade.py'. The script would typically handle making API requests to an image recognition service.
```python
import time
import hashlib
import requests
import base64
```
--------------------------------
### Initialize Camera and Session on Start
Source: https://www.easyar.com/doc/en/develop/unity/cameras/external-device-frame-source.html
Overrides the OnSessionStart method to perform AR-related initialization, such as starting camera coroutines. It's crucial to call the base OnSessionStart first. This method is suitable for opening device cameras and obtaining calibration data.
```csharp
protected override void OnSessionStart(ARSession session)
{
base.OnSessionStart(session);
StartCoroutine(InitializeCamera());
}
```
--------------------------------
### VideoInputFramePlayer - Start Playback
Source: https://www.easyar.com/doc/en/api/native/easyar.VideoInputFramePlayer.html
Starts the playback of a video file. Requires the file path as a parameter.
```APIDOC
## POST /start
### Description
Starts the playback of a video file. Requires the file path as a parameter.
### Method
POST
### Endpoint
/start
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
- **filePath** (String) - Required - The path to the video file to play.
### Request Example
```json
{
"filePath": "/path/to/your/video.mp4"
}
```
### Response
#### Success Response (200)
- **status** (Boolean) - True if playback started successfully, false otherwise.
#### Response Example
```json
{
"status": true
}
```
```
--------------------------------
### Start Playback
Source: https://www.easyar.com/doc/en/api/native/easyar.VideoInputFramePlayer.html
Starts the video playback from the specified file path. Returns a boolean indicating success.
```c
bool easyar_VideoInputFramePlayer_start(easyar_VideoInputFramePlayer * This, easyar_String * filePath)
```
```cpp
bool start(std::string filePath)
```
```java
public boolean start(java.lang.@Nonnull String filePath)
```
```kotlin
fun start(filePath: String): Boolean
```
```objective-c
- (bool)start:(NSString *)filePath
```
```swift
public func start(_ filePath: String) -> Bool
```
```csharp
public virtual bool start(string filePath)
```
--------------------------------
### Start Recording
Source: https://www.easyar.com/doc/en/api/native/easyar.InputFrameRecorder.html
Starts recording data to the specified file path. The initialScreenRotation parameter sets the rotation basis for playback.
```c
bool easyar_InputFrameRecorder_start(easyar_InputFrameRecorder * This, easyar_String * filePath, int initialScreenRotation)
```
```cpp
bool start(std::string filePath, int initialScreenRotation)
```
```java
public boolean start(java.lang.@Nonnull String filePath, int initialScreenRotation)
```
```kotlin
fun start(filePath: String, initialScreenRotation: Int): Boolean
```
```objective-c
- (bool)start:(NSString *)filePath initialScreenRotation:(int)initialScreenRotation
```
```swift
public func start(_ filePath: String, _ initialScreenRotation: Int32) -> Bool
```
```csharp
public virtual bool start(string filePath, int initialScreenRotation)
```
--------------------------------
### Request Example for Get Single Target Image
Source: https://www.easyar.com/doc/en/api/cloud/cloud-recognition/target-get.html
This example demonstrates how to make a GET request to retrieve details for a specific target image. It includes the endpoint, required query parameters like timestamp, appKey, and signature, and HTTP headers.
```http
GET /target/e61db301-e80f-4025-b822-9a00eb48d8d2?timestamp=xxx&appKey=xxx&signature=xxx
HTTP/1.1
Host:
Date: Mon, 1 Jan 2018 00:00:00 GMT
```
--------------------------------
### .NET Console Project Setup
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-grading.html
Instructions to create and run a .NET console project for EasyAR integration. This involves using the dotnet CLI to create a new console application and then executing it. The provided code snippet initializes necessary string variables for API credentials and host configuration.
```csharp
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Net.Http;
using System.Text.Json;
class Program {
static string API_KEY = "YOUR_API_KEY";
static string API_SECRET = "YOUR_API_SECRET";
static string APP_ID = "YOUR_APP_ID";
```
--------------------------------
### setupActivity
Source: https://www.easyar.com/doc/en/api/native/easyar.Engine.html
Passes a content-bearing Activity to EasyAR to handle permissions and screen recording.
```APIDOC
## [STATIC] setupActivity
### Description
Registers an Activity for permission requests and screen recording. Must be called before initialization in Unity environments.
### Method
STATIC
### Parameters
#### Path Parameters
- **activity** (android.app.Activity) - Required - The current application activity.
### Response
#### Success Response (200)
- **result** (Boolean) - Returns true if the activity was successfully set.
### Response Example
{
"result": true
}
```
--------------------------------
### Response Example for Get Single Target Image
Source: https://www.easyar.com/doc/en/api/cloud/cloud-recognition/target-get.html
This example shows a successful JSON response when requesting details for a single target image. It includes the status code, target image information such as ID, tracking image, name, size, and metadata, along with a server timestamp.
```json
HTTP/1.1 200 OK
Content-Type: application/json
{
"statusCode": 0,
"result": {
"targetId":"e61db301-e80f-4025-b822-9a00eb48d8d2",
"trackingImage":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
"name": "easyar",
"size": "5",
"meta": "496fbbabc2b38ecs3460a...",
"type": "ImageTarget",
"date": "2016-06-15T09:56:30.000Z",
"active":"1",
"trackableRate": 0,
"detectableRate": 0,
"detectableDistinctiveness": 0,
"detectableFeatureCount": 0,
"trackableDistinctiveness": 0,
"trackableFeatureCount": 0,
"trackableFeatureDistribution": 0,
"trackablePatchContrast": 0,
"trackablePatchAmbiguity": 0
},
"timestamp": 1514736000000
}
```
--------------------------------
### Get current image size
Source: https://www.easyar.com/doc/en/api/native/easyar.MotionTrackerCameraDevice.html
Retrieves the current image dimensions. This method should be called after a successful start.
```c
easyar_Vec2I easyar_MotionTrackerCameraDevice_size(const easyar_MotionTrackerCameraDevice * This)
```
```cpp
Vec2I size()
```
```java
public @Nonnull Vec2I size()
```
```kotlin
fun size(): Vec2I
```
```objective-c
- (easyar_Vec2I *)size
```
```swift
public func size() -> Vec2I
```
```csharp
public virtual Vec2I size()
```
--------------------------------
### Initialize XREALCameraDevice
Source: https://www.easyar.com/doc/en/api/native/easyar.XREALCameraDevice.html
Constructs a new instance of the XREALCameraDevice. This is the entry point for initializing the camera device before starting data collection.
```c
void easyar_XREALCameraDevice__ctor(easyar_XREALCameraDevice * * Return);
```
```cpp
XREALCameraDevice();
```
```java
public XREALCameraDevice();
```
```kotlin
constructor();
```
```objective-c
+ (easyar_XREALCameraDevice *) create;
```
```swift
public convenience init();
```
```csharp
public XREALCameraDevice();
```
--------------------------------
### Get camera device type
Source: https://www.easyar.com/doc/en/api/native/easyar.MotionTrackerCameraDevice.html
Retrieves the camera device type. This method should be called after a successful start.
```c
easyar_CameraDeviceType easyar_MotionTrackerCameraDevice_type(const easyar_MotionTrackerCameraDevice * This)
```
```cpp
CameraDeviceType type()
```
```java
public int type()
```
```kotlin
fun type(): Int
```
```objective-c
- (easyar_CameraDeviceType)type
```
```swift
public func type() -> CameraDeviceType
```
```csharp
public virtual CameraDeviceType type()
```
--------------------------------
### Project Setup for .NET Console Application
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-adding.html
This section outlines the steps to set up a .NET console project for interacting with the EasyAR CRS API. It involves creating a new console project using the `dotnet new console` command and then running it with `dotnet run`. This is a foundational step before implementing the C# code for API interaction.
```bash
dotnet new console
dotnet run
```
--------------------------------
### Get MegaTracker Proximity Location Result Sink Across Languages
Source: https://www.easyar.com/doc/en/api/native/easyar.MegaTracker.html
Examples of how to get the optional proximity location result sink for the MegaTracker in different programming languages. This sink handles proximity-based location information.
```c
void easyar_MegaTracker_proximityLocationResultSink(easyar_MegaTracker * This, easyar_ProximityLocationResultSink * * Return)
```
```cpp
std::shared_ptr proximityLocationResultSink()
```
```java
public @Nonnull ProximityLocationResultSink proximityLocationResultSink()
```
```kotlin
fun proximityLocationResultSink(): ProximityLocationResultSink
```
```objective-c
- (easyar_ProximityLocationResultSink *)proximityLocationResultSink
```
```swift
public func proximityLocationResultSink() -> ProximityLocationResultSink
```
```csharp
public virtual ProximityLocationResultSink proximityLocationResultSink()
```
--------------------------------
### Initialize ARKitCameraDevice
Source: https://www.easyar.com/doc/en/api/native/easyar.ARKitCameraDevice.html
Constructs a new instance of the ARKitCameraDevice.
```c
void easyar_ARKitCameraDevice__ctor(easyar_ARKitCameraDevice * * Return)
```
```cpp
ARKitCameraDevice()
```
```java
public ARKitCameraDevice()
```
```kotlin
constructor()
```
```objective-c
+ (easyar_ARKitCameraDevice *) create
```
```swift
public convenience init()
```
```csharp
public ARKitCameraDevice()
```
--------------------------------
### Retrieve Target Image List (HTTP Request Example)
Source: https://www.easyar.com/doc/en/api/cloud/cloud-recognition/target-list.html
This example demonstrates how to make an HTTP GET request to the /targets/infos endpoint to retrieve a list of target images. It includes query parameters for pagination and authentication details.
```http
GET /targets/infos?pageNum=2×tamp=xxx&appKey=xxx&signature=xxx
HTTP/1.1
Host:
Date: Mon, 1 Jan 2018 00:00:00 GMT
```
--------------------------------
### Create VideoInputFrameRecorder Instance
Source: https://www.easyar.com/doc/en/api/native/easyar.VideoInputFrameRecorder.html
Instantiates a new VideoInputFrameRecorder object.
```c
void easyar_VideoInputFrameRecorder_create(easyar_VideoInputFrameRecorder * * Return)
```
```cpp
static std::shared_ptr create()
```
```java
public static @Nonnull VideoInputFrameRecorder create()
```
```kotlin
companion object fun create(): VideoInputFrameRecorder
```
```objective-c
+ (easyar_VideoInputFrameRecorder *)create
```
```swift
public static func create() -> VideoInputFrameRecorder
```
```csharp
public static VideoInputFrameRecorder create()
```
--------------------------------
### ServiceAccessData Property (C#)
Source: https://www.easyar.com/doc/en/api/unity/easyar.CloudRecognizerFrameFilter.html
Manages service access data for the CloudRecognizerFrameFilter. Modifications are only effective before the session starts. Using GlobalConfig requires no additional setup.
```csharp
public ExplicitAddressAccessData ServiceAccessData { get; set; }__
```
--------------------------------
### Get camera orientation
Source: https://www.easyar.com/doc/en/api/native/easyar.MotionTrackerCameraDevice.html
Returns the clockwise rotation angle required to display the camera image in the device's natural orientation. Must be called after a successful start.
```c
int easyar_MotionTrackerCameraDevice_cameraOrientation(const easyar_MotionTrackerCameraDevice * This)
```
```cpp
int cameraOrientation()
```
```java
public int cameraOrientation()
```
```kotlin
fun cameraOrientation(): Int
```
```objective-c
- (int)cameraOrientation
```
```swift
public func cameraOrientation() -> Int32
```
```csharp
public virtual int cameraOrientation()
```
--------------------------------
### Open() Method - C#
Source: https://www.easyar.com/doc/en/api/unity/easyar.AREngineFrameSource.html
Opens the device. If not called manually, it will automatically open upon startup. This method is crucial for initializing the camera or other required hardware for AR functionality.
```csharp
public void Open()__
```
--------------------------------
### Example Response for Get Meta Data Download Address (JSON)
Source: https://www.easyar.com/doc/en/api/cloud/spatial-map/armap-meta.html
This JSON structure represents a successful response from the API, providing the metadata filename, download URL components (protocol, host, path, query), and file readability status. It includes a status code of 0 for success.
```json
{
"statusCode": 0,
"msg": "success",
"timestamp": "2026-01-30T10:00:00Z",
"result": {
"filename": "map_metadata.json",
"url": {
"protocol": "https",
"host": "armap-api-cn1.easyar.com",
"path": "/download/path/to/meta",
"query": "token=..."
},
"readable": true,
"open": false
}
}
```
--------------------------------
### Open Device
Source: https://www.easyar.com/doc/en/api/unity/easyar.AREngineFrameSource.html
Opens the device. If not called manually, it will automatically open upon startup.
```APIDOC
## void Open()
### Description
Opens the device. If not called manually, it will automatically open upon startup.
### Method
Public
### Endpoint
N/A (Method call)
### Parameters
None
### Request Example
```csharp
EasyAR.Device.Open();
```
### Response
#### Success Response
N/A (void method)
#### Response Example
N/A
```
--------------------------------
### Get MegaTracker Output Frame Source Across Languages
Source: https://www.easyar.com/doc/en/api/native/easyar.MegaTracker.html
Code examples for accessing the output frame source of the MegaTracker in different languages. This source provides the processed frames for further use.
```c
void easyar_MegaTracker_outputFrameSource(easyar_MegaTracker * This, easyar_OutputFrameSource * * Return)
```
```cpp
std::shared_ptr outputFrameSource()
```
```java
public @Nonnull OutputFrameSource outputFrameSource()
```
```kotlin
fun outputFrameSource(): OutputFrameSource
```
```objective-c
- (easyar_OutputFrameSource *)outputFrameSource
```
```swift
public func outputFrameSource() -> OutputFrameSource
```
```csharp
public virtual OutputFrameSource outputFrameSource()
```
--------------------------------
### Open Camera Device
Source: https://www.easyar.com/doc/en/api/native/easyar.XREALCameraDevice.html
Initializes the camera device. Must be called after isDeviceSupported returns true, and requires valid XREAL licensing on specific hardware.
```c
bool easyar_XREALCameraDevice_open(easyar_XREALCameraDevice * This)
```
```cpp
bool open()
```
```java
public boolean open()
```
```kotlin
fun open(): Boolean
```
```objective-c
- (bool)open
```
```swift
public func `open`() -> Bool
```
```csharp
public virtual bool open()
```
--------------------------------
### Get MegaTracker Accelerometer Result Sink Across Languages
Source: https://www.easyar.com/doc/en/api/native/easyar.MegaTracker.html
Code examples for retrieving the accelerometer result sink for the MegaTracker in different programming languages. This sink is used to process accelerometer data.
```c
void easyar_MegaTracker_accelerometerResultSink(easyar_MegaTracker * This, easyar_AccelerometerResultSink * * Return)
```
```cpp
std::shared_ptr accelerometerResultSink()
```
```java
public @Nonnull AccelerometerResultSink accelerometerResultSink()
```
```kotlin
fun accelerometerResultSink(): AccelerometerResultSink
```
```objective-c
- (easyar_AccelerometerResultSink *)accelerometerResultSink
```
```swift
public func accelerometerResultSink() -> AccelerometerResultSink
```
```csharp
public virtual AccelerometerResultSink accelerometerResultSink()
```
--------------------------------
### Initialize AR Session
Source: https://www.easyar.com/doc/en/develop/unity/cameras/external-image-stream-frame-source.html
Override OnSessionStart to perform AR-specific initialization. Ensure to call the base method first. This is where you can open the device camera, obtain calibration data, and start the data input loop.
```csharp
protected override void OnSessionStart(ARSession session)
{
base.OnSessionStart(session);
...
}
```
```csharp
protected override void OnSessionStart(ARSession session)
{
base.OnSessionStart(session);
...
player.Play();
StartCoroutine(VideoDataToInputFrames());
}
```
--------------------------------
### Initialize CameraDevice
Source: https://www.easyar.com/doc/en/api/native/easyar.CameraDevice.html
Constructs a new instance of the CameraDevice class. This is the entry point for setting up camera data acquisition.
```c
void easyar_CameraDevice__ctor(easyar_CameraDevice * * Return);
```
```cpp
CameraDevice();
```
```java
public CameraDevice();
```
```kotlin
constructor();
```
```objective-c
+ (easyar_CameraDevice *) create;
```
```swift
public convenience init();
```
```csharp
public CameraDevice();
```
--------------------------------
### WebAR Constructor for Camera and Recognition
Source: https://www.easyar.com/doc/en/develop/web/cloud-recognition/sample.html
The constructor for the `WebAR` class, responsible for camera and cloud recognition setup. It takes parameters for the recognition interval, the recognition service URL, an authentication token, and the HTML container element for the WebAR view.
```javascript
constructor(interval, recognizeUrl, token, container) {
}
```
--------------------------------
### Update SparseSpatialMapBuilderFrameFilter Acquisition (C#)
Source: https://www.easyar.com/doc/en/develop/unity/migration/migration-to-4000-sample-sparse-building.html
This code shows how to update the method for obtaining `SparseSpatialMapBuilderFrameFilter` in the `Awake` method for EasyAR Sense Unity Plugin migration. The original version directly obtained the component, while the new version subscribes to session state changes to get the filter after the AR session is ready.
```csharp
sparse = Session.GetComponentInChildren();
```
```csharp
Session.StateChanged += (state) =>
{
if (state == ARSession.SessionState.Ready)
{
sparse = Session.Assembly.FrameFilters.Where(f => f is SparseSpatialMapBuilderFrameFilter).FirstOrDefault() as SparseSpatialMapBuilderFrameFilter;
}
};
```
--------------------------------
### Initialize ThreeDofCameraDevice
Source: https://www.easyar.com/doc/en/api/native/easyar.ThreeDofCameraDevice.html
Creates a new instance of the ThreeDofCameraDevice. This is the entry point for initializing the 3-DOF tracking device.
```c
void easyar_ThreeDofCameraDevice__ctor(easyar_ThreeDofCameraDevice * * Return);
```
```cpp
ThreeDofCameraDevice();
```
```java
public ThreeDofCameraDevice();
```
```kotlin
constructor();
```
```objective-c
+ (easyar_ThreeDofCameraDevice *) create;
```
```swift
public convenience init();
```
```csharp
public ThreeDofCameraDevice();
```
--------------------------------
### POST /create
Source: https://www.easyar.com/doc/en/api/native/easyar.CloudRecognizer.html
Creates and initializes a new CloudRecognizer instance using API credentials.
```APIDOC
## POST /create
### Description
Creates and connects to the cloud recognition server using server address, API key, API secret, and App ID.
### Method
POST
### Endpoint
/create
### Parameters
#### Request Body
- **cloudRecognitionServiceServerAddress** (string) - Required - The URL of the cloud recognition service.
- **apiKey** (string) - Required - The API key for authentication.
- **apiSecret** (string) - Required - The API secret for authentication.
- **cloudRecognitionServiceAppId** (string) - Required - The unique identifier for the cloud recognition app.
### Request Example
{
"cloudRecognitionServiceServerAddress": "https://example.com",
"apiKey": "your_api_key",
"apiSecret": "your_api_secret",
"cloudRecognitionServiceAppId": "your_app_id"
}
### Response
#### Success Response (200)
- **cloudRecognizer** (object) - The initialized CloudRecognizer instance.
#### Response Example
{
"status": "success",
"instanceId": "cr_001"
}
```
--------------------------------
### Start SurfaceTracker Algorithm Across Languages
Source: https://www.easyar.com/doc/en/api/native/easyar.SurfaceTracker.html
This method starts the surface tracking algorithm. Ensure that input frames are being provided to the inputFrameSink before calling start.
```c
bool easyar_SurfaceTracker_start(easyar_SurfaceTracker * This)__
```
```cpp
bool start()__
```
```java
public boolean start()__
```
```kotlin
fun start(): Boolean__
```
```objective-c
- (bool)start__
```
```swift
public func start() -> Bool__
```
```csharp
public virtual bool start()__
```
--------------------------------
### Initialize EasyAR Sense with License Key (C#)
Source: https://www.easyar.com/doc/en/api/unity/easyar.EasyARController.html
Initializes the EasyAR Sense engine using a provided license key. Manual calling is often unnecessary if 'InitializeOnStartup' is enabled. Returns a boolean indicating success.
```csharp
public static bool Initialize(string licenseKey)
```
--------------------------------
### Start AR Playback (C#)
Source: https://www.easyar.com/doc/en/api/unity/easyar.FramePlayer.html
Initiates playback of an eif file. If not manually called, Play() is invoked automatically after the ARSession starts. This method can only be used after the session has started.
```csharp
public bool Play()
```
--------------------------------
### Start SparseSpatialMap Algorithm
Source: https://www.easyar.com/doc/en/api/native/easyar.SparseSpatialMap.html
Initializes and starts the SparseSpatialMap algorithm processing.
```c
bool easyar_SparseSpatialMap_start(easyar_SparseSpatialMap * This)
```
```cpp
bool start()
```
```java
public boolean start()
```
```kotlin
fun start(): Boolean
```
```objective-c
- (bool)start
```
```swift
public func start() -> Bool
```
```csharp
public virtual bool start()
```
--------------------------------
### AREngineFrameSource Method: OnSessionStart
Source: https://www.easyar.com/doc/en/api/unity/easyar.AREngineFrameSource.html
Handles the startup of an AR session. This method is intended for lazy initialization and allows for AR-specific setup when the frame source is assembled into an ARSession. It is provided when a new frame source is created.
```csharp
protected override void OnSessionStart(ARSession session)__
```
--------------------------------
### Install ADB Tools on Mac using Homebrew
Source: https://www.easyar.com/doc/en/mega/data-collection/simulation/export.html
This command installs the Android Platform Tools, which include ADB (Android Debug Bridge), on a Mac using the Homebrew package manager. Ensure Homebrew is installed before running this command.
```bash
brew install --cask android-platform-tools
```
--------------------------------
### Initialize RecorderConfiguration
Source: https://www.easyar.com/doc/en/api/native/easyar.RecorderConfiguration.html
Constructs a new instance of the RecorderConfiguration object to prepare for screen recording setup.
```c
void easyar_RecorderConfiguration__ctor(easyar_RecorderConfiguration * * Return)
```
```cpp
RecorderConfiguration()
```
```java
public RecorderConfiguration()
```
```kotlin
constructor()
```
```objective-c
+ (easyar_RecorderConfiguration *) create
```
```swift
public convenience init()
```
```csharp
public RecorderConfiguration()
```
--------------------------------
### Initialize VisionOSARKitCameraDevice
Source: https://www.easyar.com/doc/en/api/native/easyar.VisionOSARKitCameraDevice.html
Constructs a new instance of the VisionOSARKitCameraDevice. This is the entry point for setting up the ARKit camera stream.
```c
void easyar_VisionOSARKitCameraDevice__ctor(easyar_VisionOSARKitCameraDevice * * Return);
```
```cpp
VisionOSARKitCameraDevice();
```
```java
public VisionOSARKitCameraDevice();
```
```kotlin
constructor();
```
```objective-c
+ (easyar_VisionOSARKitCameraDevice *) create;
```
```swift
public convenience init();
```
```csharp
public VisionOSARKitCameraDevice();
```
--------------------------------
### Start Tracking Algorithm
Source: https://www.easyar.com/doc/en/api/native/easyar.ObjectTracker.html
Initializes and starts the tracking process. Returns a boolean indicating success or failure.
```c
bool easyar_ObjectTracker_start(easyar_ObjectTracker * This);
```
```cpp
bool start();
```
```java
public boolean start();
```
```kotlin
fun start(): Boolean
```
```objective-c
- (bool)start;
```
```swift
public func start() -> Bool
```
```csharp
public virtual bool start();
```
--------------------------------
### Create AR Session with Presets
Source: https://www.easyar.com/doc/en/develop/unity/fundamentals/session-creation.html
Demonstrates how to programmatically instantiate an AR session using predefined presets. This includes basic image tracking setups and advanced spatial mapping configurations requiring specific resource materials.
```csharp
ARSessionFactory.CreateSession(ARSessionFactory.ARSessionPreset.ImageTracking);
ARSessionFactory.CreateSession(ARSessionFactory.ARSessionPreset.SparseSpatialMapBuilder, new ARSessionFactory.Resources { SparseSpatialMapPointCloudMaterial = PointCloudMaterial });
ARSessionFactory.CreateSession(ARSessionFactory.ARSessionPreset.SparseSpatialMapBuilder, ARSessionFactory.Resources.EditorDefault());
```
--------------------------------
### List Maps via Java
Source: https://www.easyar.com/doc/en/develop/sparse-spatial-mapping/management-gallery.html
Java implementation using the OkHttp library to fetch maps. It requires configuring authentication parameters and signing the request.
```java
import okhttp3.OkHttpClient;
import okhttp3.Response;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Set;
public class ListMaps {
private static final String CLOUD_URL = "https://armap-api.easyar.com";
private static final String APPID = "--here is your SpatialMap AppId--";
private static final String API_KEY = "--here is your API Key--";
private static final String API_SECRET = "--here is your API Secret--";
public String toParam(JSONObject jso) {
Set keys = jso.keySet();
StringBuffer sb = new StringBuffer();
for (String key : keys){
sb.append(key);
sb.append("=");
sb.append(jso.getString(key));
sb.append("&");
}
return sb.substring(0,sb.length()-1);
}
public String list(Auth auth) throws IOException {
OkHttpClient client = new OkHttpClient.Builder().build();
JSONObject params = new JSONObject();
Auth.signParam(params, auth.getAppId(), auth.getApiKey(), auth.getApiSecret());
okhttp3.Request request = new okhttp3.Request.Builder()
.url(auth.getCloudURL() + "/maps?"+ toParam(params))
.get()
.build();
Response response = client.newCall(request).execute();
return response.body().string();
}
public static void main(String[] args) throws IOException{
Auth accessInfo = new Auth(APPID, API_KEY, API_SECRET, CLOUD_URL);
System.out.println(new ListMaps().list(accessInfo));
}
}
```
--------------------------------
### GET /maps
Source: https://www.easyar.com/doc/en/api/cloud/spatial-map/armap-list.html
Retrieves a paginated list of all Spatial Maps under the current gallery.
```APIDOC
## GET /maps
### Description
This interface is used to paginate and retrieve the list information of all Spatial Maps under the current gallery.
### Method
GET
### Endpoint
`https://armap-api-.easyar.com/maps`
### Parameters
#### Query Parameters
- **pageNum** (Integer) - Optional - The target page number to request (Default: 1).
- **pageSize** (Integer) - Optional - The maximum number of maps per page (Default: 10).
### Request Example
GET /maps?pageNum=1&pageSize=10
### Response
#### Success Response (200)
- **statusCode** (Integer) - Status code. 0 indicates success.
- **msg** (String) - Status description message.
- **timestamp** (DateTime) - Server response timestamp.
- **result** (Object) - A Map object containing an array of map data and pagination statistics.
#### Response Example
{
"result": {
"armaps": [
{
"mapId": "62d4f765-cc54-4dff-9c48-b7c8b4adbde9",
"name": "Map_2020-09-28_1302",
"status": "active"
}
],
"page": {
"total": 2,
"pageNum": 1,
"pageSize": 10,
"pages": 1
}
},
"statusCode": 0,
"msg": "Success",
"timestamp": 1769406021019
}
```
--------------------------------
### Initialize ImageTargetParameters
Source: https://www.easyar.com/doc/en/api/native/easyar.ImageTargetParameters.html
Constructs a new instance of the ImageTargetParameters class. This is the entry point for configuring target settings before creation.
```c
void easyar_ImageTargetParameters__ctor(easyar_ImageTargetParameters * * Return)
```
```cpp
ImageTargetParameters()
```
```java
public ImageTargetParameters()
```
```kotlin
constructor()
```
```objective-c
+ (easyar_ImageTargetParameters *) create
```
```swift
public convenience init()
```
```csharp
public ImageTargetParameters()
```
--------------------------------
### Run Node.js Target Creation Script
Source: https://www.easyar.com/doc/en/develop/cloud-recognition/management-adding.html
This command executes the Node.js script to add a target. It requires the path to the test image, the server-end URL, and the path to the keys configuration file. The script will then use these parameters to create the target in the EasyAR cloud.
```bash
node bin/addTarget test.jpeg -t -c keys.json
```
--------------------------------
### Start Motion Tracking
Source: https://www.easyar.com/doc/en/api/native/easyar.MotionTrackerCameraDevice.html
Starts the motion tracking process or triggers relocation from a paused state. Tracking resumes only after successful relocation.
```c
bool easyar_MotionTrackerCameraDevice_start(easyar_MotionTrackerCameraDevice * This);
```
```cpp
bool start();
```
```java
public boolean start();
```
```kotlin
fun start(): Boolean
```
```objective-c
- (bool)start;
```
```swift
public func start() -> Bool
```
```csharp
public virtual bool start();
```
--------------------------------
### initialize (Android with SoLibraryDir)
Source: https://www.easyar.com/doc/en/api/native/easyar.Engine.html
Initializes the EasyAR Engine for Android, specifying the native library directory.
```APIDOC
## POST /engine/initialize/android/soLibraryDir
### Description
Initialize EasyAR for Android. Requires passing in a content-bearing Activity to implement functions such as permission requests and screen recording. Equivalent to first calling loadLibraries, then setupActivity, then initializeKey. Can specify the native library directory.
### Method
POST
### Endpoint
/engine/initialize/android/soLibraryDir
### Parameters
#### Request Body
- **activity** (Object) - Required - The Android Activity context.
- **licenseKey** (String) - Required - The license key for EasyAR.
- **soLibraryDir** (String) - Required - The directory containing the native libraries.
### Request Example
```json
{
"activity": "",
"licenseKey": "YOUR_LICENSE_KEY",
"soLibraryDir": "/path/to/libs"
}
```
### Response
#### Success Response (200)
- **initialized** (Boolean) - True if initialization was successful, false otherwise.
#### Response Example
```json
{
"initialized": true
}
```
```
--------------------------------
### Initialize ARCoreDeviceListDownloader
Source: https://www.easyar.com/doc/en/api/native/easyar.ARCoreDeviceListDownloader.html
Constructs a new instance of the ARCoreDeviceListDownloader class. This is the entry point for managing device list calibration updates.
```c
void easyar_ARCoreDeviceListDownloader__ctor(easyar_ARCoreDeviceListDownloader * * Return)
```
```cpp
ARCoreDeviceListDownloader()
```
```java
public ARCoreDeviceListDownloader()
```
```kotlin
constructor()
```
```objective-c
+ (easyar_ARCoreDeviceListDownloader *) create
```
```swift
public convenience init()
```
```csharp
public ARCoreDeviceListDownloader()
```
--------------------------------
### GET /target/
Source: https://www.easyar.com/doc/en/api/cloud/cloud-recognition/target-get.html
Retrieves detailed information for a single target image using its unique ID.
```APIDOC
## GET /target/
### Description
Retrieves detailed information for a single target image using its unique ID.
### Method
GET
### Endpoint
`/target/`
### Parameters
#### Path Parameters
- **target_id** (string) - Required - The unique identifier of the target image.
#### Query Parameters
- **timestamp** (string) - Required - Server-side time when the response is returned. Using Unix timestamp format in milliseconds.
- **appKey** (string) - Required - Your application's API key.
- **signature** (string) - Required - The signature generated for authentication.
### Request Example
```
GET /target/e61db301-e80f-4025-b822-9a00eb48d8d2?timestamp=xxx&appKey=xxx&signature=xxx
HTTP/1.1
Host:
Date: Mon, 1 Jan 2018 00:00:00 GMT
```
### Response
#### Success Response (200)
- **statusCode** (integer) - Status code 0 indicates correct authentication. See Status codes for more references.
- **result** (object) - Error message, or target image information.
- **targetId** (string) - Unique ID of the target image.
- **trackingImage** (string) - Base64-encoded string of the tracking image.
- **name** (string) - Target name.
- **size** (string) - Recognition image width (unit cm). The height of the recognition image will be automatically calculated by the system based on the uploaded picture. The size of the recognition image corresponds to the size of the overlaid virtual content.
- **meta** (string) - Base64-encoded additional information, such as a string generated by base64 encoding a JSON string.
- **type** (string) - Fixed as ImageTarget.
- **active** (string) - "1" enabled, "0" disabled.
- **timestamp** (integer) - Server-side time when the response is returned. Using Unix timestamp format in milliseconds.
#### Response Example
```json
{
"statusCode": 0,
"result": {
"targetId":"e61db301-e80f-4025-b822-9a00eb48d8d2",
"trackingImage":"/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgM...",
"name": "easyar",
"size": "5",
"meta": "496fbbabc2b38ecs3460a...",
"type": "ImageTarget",
"date": "2016-06-15T09:56:30.000Z",
"active":"1",
"trackableRate": 0,
"detectableRate": 0,
"detectableDistinctiveness": 0,
"detectableFeatureCount": 0,
"trackableDistinctiveness": 0,
"trackableFeatureCount": 0,
"trackableFeatureDistribution": 0,
"trackablePatchContrast": 0,
"trackablePatchAmbiguity": 0
},
"timestamp": 1514736000000
}
```
### Error codes
See Status codes and error code list.
```
--------------------------------
### GET /map/meta/{mapId}
Source: https://www.easyar.com/doc/en/api/cloud/spatial-map/armap-meta.html
Retrieves the download resource information for the metadata associated with a specific Spatial Map.
```APIDOC
## GET /map/meta/{mapId}
### Description
This interface is used to obtain the download resource information for the metadata (meta) associated with a specific Spatial Map by its `mapId`.
### Method
GET
### Endpoint
`https://armap-api-.easyar.com/map/meta/{mapId}`
### Parameters
#### Path Parameters
- **mapId** (String) - Required - The unique identifier (MapId) of the Spatial Map.
### Request Example
GET /map/meta/12345
Header: Authorization: [token]
Header: AppId: [your_app_id]
### Response
#### Success Response (200)
- **statusCode** (Integer) - Status code. 0 indicates success.
- **msg** (String) - Status description message.
- **timestamp** (DateTime) - Server response timestamp.
- **result** (Object) - A Resource object containing metadata file details.
#### Response Example
{
"statusCode": 0,
"msg": "success",
"timestamp": "2026-01-30T10:00:00Z",
"result": {
"filename": "map_metadata.json",
"url": {
"protocol": "https",
"host": "armap-api-cn1.easyar.com",
"path": "/download/path/to/meta",
"query": "token=..."
},
"readable": true,
"open": false
}
}
```
--------------------------------
### Get Synchronous Tracking Result
Source: https://www.easyar.com/doc/en/api/native/easyar.ImageTracker.html
Gets the synchronous output result. Returns empty if the tracker is paused or if asynchronous mode is enabled.
```c
void easyar_ImageTracker_getSyncResult(easyar_ImageTracker * This, easyar_MotionInputData * motionInputData, easyar_OptionalOfImageTrackerResult * Return);
```
```cpp
std::optional> getSyncResult(std::shared_ptr motionInputData);
```
```java
public @Nullable ImageTrackerResult getSyncResult(@Nonnull MotionInputData motionInputData);
```
```kotlin
fun getSyncResult(motionInputData: MotionInputData): ImageTrackerResult?;
```
```objective-c
- (easyar_ImageTrackerResult *)getSyncResult:(easyar_MotionInputData *)motionInputData;
```
```swift
public func getSyncResult(_ motionInputData: MotionInputData) -> ImageTrackerResult?;
```
```csharp
public virtual Optional getSyncResult(MotionInputData motionInputData);
```
--------------------------------
### OnSessionStart Method Implementation
Source: https://www.easyar.com/doc/en/api/unity/easyar.EditorCameraDeviceFrameSource.html
Handles session startup for the frame source when it's part of an Assembly. This method is intended for delayed AR-specific initialization during the StartSession() process.
```csharp
protected override void OnSessionStart(ARSession session)
```