Coder Social home page Coder Social logo

ar-unity's Introduction

AR-Unity

This is an augmented reality application in the Unity game engine.

Requirements

This project is in two parts:

  • ALVARBridge - this is the bridge between ALVAR's C++ functions and Unity C# scripts.
  • AR-Unity - this is the Unity application, using the augmented reality.

ALVARBridge

This bridge creates an unmanaged DLL called ALVARBridge.dll. We need it, since ALVAR is in C++, and Unity doesn't support it, but supports C# scripts instead. This allows us to call C++ functions in C# scripts.

The DLL

The following functions are used to detect markers in the image:

  • void alvar_init(int width, int height) is used to initialize the detection of the markers.
  • void alvar_process(int* imageData, double* transMatrix) detect the markers, and modify the transformation matrix. This transformation matrix is then used in Unity to move any object on the markers.

The ALVARBridge.dll is directly exported in the Assets\Plugins directory of the Unity application.

Markers

Since this is inspired by DemoMarkerField, a demo application provided with the ALVAR library, the markers used are the same as this demo. You can found it in the ALVAR.pdf.

Calibration

You need to calibrate your webcam. See the manual and ALVAR internal samples on how to calibrate your camera. The XML files for the calibration are in the Assets\Calibrations directory of the Unity application.

The current calibration file used is specific to my webcam.

Since our goal is to use the [Vuzix's Wrap 920AR] (http://www.vuzix.com/consumer/products_wrap920ar.html), some calibration files for these augmented reality eyewear are also present. These Wrap920_*.xml files come from the [Goblin XNA] (https://goblinxna.codeplex.com/) framework.

AR-Unity

This is the Unity project.

The video stream of the webcam is projected on a plane, and an object ressembling a paper with markers is moving according to the detected markers. This object could be anything, as long as it is associated with the Marker.cs script.

Scene

There are four GameObjects in the scene:

  • Cube: the object placed on the markers and moving according to their position and orientation.
  • Directional light: used to light up the plane.
  • Main Camera: the Unity camera, filming the Plane object.
  • Plane: the webcam's stream is projected on it.

C# scripts

  • ALVARBridge.cs: this is the bridge of the DLL in Unity.
  • Background.cs: this script uses ALVAR functions to detect markers in the webcam's stream.
  • Marker.cs: moves an object associated with this script, according to the markers.

Info

This project is part of our final project at EPITA.

ar-unity's People

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.