https://github.com/guilospanck/ra-opencv
Augmented Reality with OpenCV using Python
https://github.com/guilospanck/ra-opencv
ar augmented-reality opencv python ra
Last synced: 2 months ago
JSON representation
Augmented Reality with OpenCV using Python
- Host: GitHub
- URL: https://github.com/guilospanck/ra-opencv
- Owner: Guilospanck
- License: mit
- Created: 2019-09-14T17:11:32.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-12-28T15:09:50.000Z (over 1 year ago)
- Last Synced: 2025-04-06T07:28:34.273Z (about 1 year ago)
- Topics: ar, augmented-reality, opencv, python, ra
- Language: Python
- Homepage:
- Size: 496 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RA-opencv
Augmented Reality with OpenCV using Python.
## Usage
* Place the image of the surface to be tracked inside the `references` folder;
* Replace `TRAIN_IMAGE_RELATIVE_PATH` with the relative path of the train image you want to track;
* Replace `OBJ_MODEL_RELATIVE_PATH` with the relative path of the model you want to render. To change the size of the rendered model change the scale parameter `MODEL_OBJ_SCALE` to a suitable number. This might require some trial and error.
## Running
Open a terminal session inside the project folder and run:
```sh
# Activate virtualenv
virtualenv python_ra
source python_ra/bin/activate
# to deactivate: run `deactivate`
```
Then:
```sh
# Install from the requirements
pip install -r requirements.txt
python3 src/ra.py
```
### Command line arguments
* `--rectangle`, `-r`: Draws the projection of the reference surface on the video frame as a blue rectangle;
* `--matches`, `-ma`: Draws matches between reference surface and video frame.
```sh
python3 src/ra.py -r -ma
```
## Troubleshooting
**If you get the message**:
```
Unable to capture video
```
printed to your terminal, the most likely cause is that your OpenCV installation has been compiled without FFMPEG support. Pre-built OpenCV packages such as the ones downloaded via pip are not compiled with FFMPEG support, which means that you have to build it manually.