Giter Site home page Giter Site logo

js-aruco's Introduction

js-aruco is a port to JavaScript of the ArUco library.

ArUco is a minimal library for Augmented Reality applications based on OpenCv.

Demos

100% JavaScript (see details bellow):

3D Pose Estimation:

Visual Debugging:

Flash camera access (see details bellow):

Videos

Webcam video adquisition:

js-aruco

3D Pose estimation:

js-aruco

Visual Debugging:

js-aruco

Markers

A 7x7 grid with an external unused black border. Internal 5x5 cells contains id information.

Each row must follow any of the following patterns:

white - black - black - black - black

white - black - white - white - white

black - white - black - black - white

black - white - white - white - black

Example:

Marker

Usage

Create an AR.Detector object:

var detector = new AR.Detector();

Call detect function:

var markers = detector.detect(imageData);

markers result will be an array of AR.Marker objects with detected markers.

AR.Marker objects have two properties:

  • id: Marker id.
  • corners: 2D marker corners.

imageData argument must be a valid ImageData canvas object.

var canvas = document.getElementById("canvas");
    
var context = canvas.getContext("2d");

var imageData = context.getImageData(0, 0, width, height);

3D Pose Estimation

Create an POS.Posit object:

var posit = new POS.Posit(modelSize, canvas.width);

modelSize argument must be the real marker size (millimeters).

Call pose function:

var pose = posit.pose(corners);

corners must be centered on canvas:

var corners = marker.corners;

for (var i = 0; i < corners.length; ++ i){
  var corner = corners[i];

  corner.x = corner.x - (canvas.width / 2);
  corner.y = (canvas.height / 2) - corner.y;
}

pose result will be a POS.Pose object with two estimated pose (if any):

  • bestError: Error of the best estimated pose.
  • bestRotation: 3x3 rotation matrix of the best estimated pose.
  • bestTranslation: Translation vector of the best estimated pose.
  • alternativeError: Error of the alternative estimated pose.
  • alternativeRotation: 3x3 rotation matrix of the alternative estimated pose.
  • alternativeTranslation: Translation vector of the alternative estimated pose.

Note: POS namespace can be taken from posit1.js or posit2.js.

Flash Demo (deprecated)

It uses Flashcam, a minimal Flash library to capture video.

js-aruco's People

Contributors

jcmellado avatar

Watchers

 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.