Skip to content

FabioMiguel2000/Augmented-Sword

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RVA Project 1 - Augmented Sword

The main objective of this project is to develop an application that augments an image of a person wielding a reference marker by rendering a virtual sword associated with the marker. The marker may be a planar piece of wood or hard cardboard with two patterns, one on each face of the planar object. Alternatively, you may develop an improved version of the application, using a cube with patterns on five of its faces (on all faces except the one that is facing the user’s hand).

Planar Marker Virtual Sword Planar Marker
Cube Marker Virtual Sword Planar Marker

Installation and prerequisites

  • Install Python3, see official website
  • It is recommended to run in a conda environment, our advice is to use Miniconda
  • To setup the project, you need the following packages:
    • opencv-python
    • numpy
    • opencv-contrib-python

Conda environment setup

  1. After installing Miniconda, create a conda environment:
conda create -n augmented_sword python=3.11
  1. Activate the environment:
conda activate augmented_sword
  1. Install the necessary libraries:
pip install -r ../requirements.txt

Usage

How to run

  1. Make sure the augmented_sword environment is activated and you're under the src/ directory:

    conda activate augmented_sword
    
    cd src/
  2. Windows: Using the Command Line, inside the project directory:

    python main.py

    Linux/MacOS: Using the Command Line, inside the project directory:

    python3 main.py 
  3. The program will wait for q to be pressed, to close the window and exit.

How to remove

  1. Remove the created environment:
conda remove -n ENV_NAME --all
  1. Delete the local repository.

Virtual Sword Display Modes

After running the program, the device's default webcam will be used to capture the image. The image will be processed and the result will be displayed in a new window. The user can then display a virtual sword using one of two methods:

Note: In this project we use ArUcO markers that can be found here.

Simple Mode - Flat Cardboard Cutout (2 ArUcO Markers)

  • A flat card with a handle located at the bottom. It features two printed markers with the IDs 0 and 1, namely Marker_0 and Marker_1.
  • The one we used is 15cm x 15cm, and looks like the following:

image

Advanced Mode - Handheld Cube (5 ArUco Markers)

  • A cube with 5 faces, where the markers from 1 to 4 are placed on the side faces without any rotation and the marker 0 is placed on the top face, like in the following picture:

image

License

This project is licensed under the Apache License, Version 2.0.

For the complete text of the Apache License, please refer to the Apache License.