Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #3

Merged
merged 3 commits into from
Mar 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```