项目作者: jcmellado

项目描述 :
用于增强现实应用程序的JavaScript库
高级语言: JavaScript
项目地址: git://github.com/jcmellado/js-aruco.git
创建时间: 2015-03-27T19:20:18Z
项目社区:https://github.com/jcmellado/js-aruco

开源协议:Other

下载


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:

Videos

Webcam video adquisition

3D Pose estimation

Visual Debugging

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:

  1. var detector = new AR.Detector();

Call detect function:

  1. 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.

  1. var canvas = document.getElementById("canvas");
  2. var context = canvas.getContext("2d");
  3. var imageData = context.getImageData(0, 0, width, height);

3D Pose Estimation

Create an POS.Posit object:

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

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

Call pose function:

  1. var pose = posit.pose(corners);

corners must be centered on canvas:

  1. var corners = marker.corners;
  2. for (var i = 0; i < corners.length; ++ i){
  3. var corner = corners[i];
  4. corner.x = corner.x - (canvas.width / 2);
  5. corner.y = (canvas.height / 2) - corner.y;
  6. }

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.