Code Monkey home page Code Monkey logo

ar-ring-try-on's Introduction

Virtual AR Ring Try-on App

An Augmented Reality Android App, made using Unity (C#) and OpenCV, to implement virtual trials of ornamental rings.


 


Process

1. Hand and finger detection using OpenCV

The hand and fingers detection is based on skin color detection. The application is initialized by sampling color from the hand of the user with the help of seven square color trackers or ROIs.

The hand, the foreground, is then extracted from the background by thresholding with the sampled color profile. Each of the seven color in the profile produces a binary segmentation image. Then, all these seven binary images are added up to form a single binary image. This binary image is made smooth and denoised using image median blurring filters.


After the generation of the binary representation of the hand, the image is processed in the following manner:

This procedure helps in finding the ring finger of the user and getting the appropriate information required to place the ring in the next stage.

But, this procedure produces some noisy convexity defects too. To filter out these false convexity defects, we set the following constraints:

  1. The length or depth of the defect (L) > Lbb / 5.5
  2. The angle between the lines going from the defect to the neighboring convex polygon vertices (α) < 95


Now, to finally place the ring on the user's finger, the coordinates of the two leftmost convexity defects are found.


The following 3 transformational components are then set and passed to Unity,

  1. Position: The ring is placed on the midpoint of the points P1 and P2
  2. Rotation: The ring is rotated by an angle equal to the angle made by the line P1P2 with the horizontal axis
  3. Scale: The scale of the ring is set according to the length of the line segment P1P2

2. AR in Unity

The Unity Game Engine enables us to add a third dimension to the 2D input of the camera. A Scene is set in Unity as follows:


The Scene consists of the following components:

  1. Main Camera – Captures the scene and displays the final output
  2. Plane - Acts as a screen to display the input camera feed
  3. Directional Light – Illuminates the scene
  4. Rings – 5 3D ring models (Imported into Unity)

The rings are referenced as Game Objects and are transformed (position, rotation and scale) according to the data received from the 1st phase. This finally places the ring model on the user's finger.

Results

 

 

Built With

License

This project is licensed under the MIT License - see the LICENSE file for details.

ar-ring-try-on's People

Contributors

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