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 | |
---|---|
Cube Marker Virtual Sword |
- 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
- After installing Miniconda, create a conda environment:
conda create -n augmented_sword python=3.11
- Activate the environment:
conda activate augmented_sword
- Install the necessary libraries:
pip install -r ../requirements.txt
-
Make sure the
augmented_sword
environment is activated and you're under thesrc/
directory:conda activate augmented_sword cd src/
-
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
-
The program will wait for
q
to be pressed, to close the window and exit.
- Remove the created environment:
conda remove -n ENV_NAME --all
- Delete the local repository.
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.
- 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:
- 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:
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.