Skip to content

Commit

Permalink
Merge pull request #3 from JoaoLuzio14/main
Browse files Browse the repository at this point in the history
Update README.md
  • Loading branch information
plinioMoreno authored Mar 11, 2023
2 parents 5c9a37a + 0ebfe4e commit 2d3ad6d
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,47 @@ These steps assume the Anaconda Python Distribution is used, OpenCV is downloade
```sh
conda install -c anaconda scikit-image
python test.py
```

### Linux
This installation was tested on Ubuntu 22.04.1 LTS version using a [Python Virtual Environment](https://linuxopsys.com/topics/create-python-virtual-environment-on-ubuntu).
These steps assume that pip is installed and OpenCV is downloaded and extracted.

- Create and activate a [Python Virtual Environment](https://linuxopsys.com/topics/create-python-virtual-environment-on-ubuntu).
```sh
python3 -m venv my_env_project
source my_env_project/bin/activate
```
- With the Python Virtual Environment activated, [install pybind11](https://pypi.org/project/pybind11/), NumPy and *opencv* packages:
```sh
pip install pybind11
pip install numpy
pip install opencv-python
```
- Clone this repository and create a **build** directory in the root directory (*laplacian-foveation/build*):
```sh
cd %path_to_clone_directory%/laplacian_foveation
mkdir build
```
- Open CMake and specify the cloned repository directory as *source* and the created build subdirectory to *build* the binaries
- The first time you hit *Configure* some errors will likely be thrown, here are fixes/what you might need to define manually:
| Name | Value |
| ------ | ------ |
| OpenCV_DIR | **%path_to_extracted_opencv_folder%/build** |
| pybind11_DIR | **%path_to_virtualenv%/lib/site-packages/pybind11/share/cmake/pybind11** |
- When *Configure* is successful, hit *Generate* and then build/compile the project (Unix Makefiles) in the terminal:
```sh
cd build
make
```
- If *make* fails, edit the file *laplacian_foveation/src/python_bindings/conversions.cpp* replacing `#include <numpy/ndarrayobject.h>` with `#include "%path_to_virtualenv%/lib/python3.x/site-packages/numpy/core/include/numpy/ndarrayobject.h"`, where *python3.x* must be the Python3 version installed in your Python Virtual Environment.
- If the build/compile process succeeded, go to *laplacian_foveation/build/* and copy the file *laplacian_foveation.cpython-310-x86_64-linux-gnu.so* to *%path_to_virtualenv%/lib/site-packages/*
- Test the build and installation of *laplacian_foveation* by running (Python):
```sh
import laplacian_foveation as fv
```
- The *test.py* script provides a demo on foveating an image from the COCO dataset:
```sh
pip install scikit-image
python test.py
```

0 comments on commit 2d3ad6d

Please sign in to comment.