Giter Site home page Giter Site logo

anyline-guidance-sdk's Introduction

Anyline Guidance SDK

Anyline guidance sdk to retrieve high resolution image from a video stream with tire overlay that helps to point accurately to the tire.

See Migrating from v1 to v2

Installation

npm install @anyline/anyline-guidance-sdk

SDK Config and Callbacks

import init from '@anyline/anyline-guidance-sdk';
// ...
// call init when you want to start the sdk
init(config, callbacks);

1. config (required)

The config value is used to apply developer specific settings to the SDK. Currently, config can be used to control the number of times onboarding instructions are shown. For example:

const config = { 
  onboardingInstructions: { 
    timesShown: 3, 
  },
};

In this example, onboarding instructions will be shown for a total of 3 times, after which the onboarding instructions will be skipped and sdk will start directly at the Video Stream screen.

NOTE: timesShown is stored in the localStorage. Clearing the localStorage will reset the setting.

If you wish to show the onboarding instructions everytime the sdk is initialised, set config like so

const config = {};

2. callbacks (required)

The callbacks object consists of two functions: onComplete and onPreProcessingChecksFailed

  • onComplete (required) is called once the SDK has finished processing the image.
  • onPreProcessingChecksFailed (optional) is called when the image captured by an end-user has failed to pass image quality checks. The user has the option to either proceed with the image or take a new picture. Example:
const callbacks = { 
  onComplete: ({ blob }) => {
    // final returned image
  }, 
  onPreProcessingChecksFailed: ({ blob, message }) => {
    // intermediate image
  },
};

Migrating from v1 to v2

Key changes

  1. Initialisation
  • v1: init called with a single config object and returned a promise
  • v2: init called with two arguments: config and callbacks and no longer returns a promise (use callbacks to retrieve blob).
  1. Config
  • v1: can be empty
  • v2: for empty config use {}
  1. Callbacks (v2 only)
  • onComplete required
  • onPreProcessingChecksFailed optional

Example

v1:

const { blob } = await init({
  onboardingInstructions: {
    timesShown: 3
  }
})

v2:

const config = {
  onboardingInstructions: {
    timesShown: 3
  }
};
const callbacks = {
  onComplete: ({ blob }) => {
    // ...
  }
}
init(config, callbacks)

See SDK Config and Callbacks for detailed implementation about config and callbacks.


Developers / Contributors

To start

  • Make sure you are using the correct node version by running nvm use
  • If you don't have the required node version, install the required node version by running nvm install
  • (skip if the previous step is done) If you don't have nvm installed, install nvm (on MacOS) via brew install nvm
  • install yarn npm install -g yarn
  • run yarn to install the project dependencies

To Build

  • run yarn build (uses esbuild.config.js), it generates 3 files for 3 different integration environments
    • ESM (for ESM)
    • CJS (for commonJS)
    • IIFE (for direct script tag inclusions)

To Try

This will build public/index.html and serve public/index.html in a local server running on http://localhost:8000.

  Hot-reload is not supported on "index.html" at the moment, so you will have to manually refresh the page after every change.

anyline-guidance-sdk's People

Contributors

adityasingh-anyline avatar adamzanyline avatar yousif-anyline avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.