Skip to content

Commit

Permalink
Updated README and improved CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
JanPalasek committed Feb 19, 2022
1 parent a7f2a7b commit f64ab65
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ You can either:
- use it as a web app on [my website](http://janpalasek.com/fast-reflection-removal.html).

## How to install
**Prerequisities**
- Python: 3.8

### As a package
In your own project, just perform the following command:
```bash
Expand All @@ -22,7 +19,7 @@ python -m pip install fast-reflection-removal

Now, you can use the reflection removal in your project in the following manner:
```python
from frr.core import FastReflectionRemoval
from frr import FastReflectionRemoval

...
# numpy array with values between 0 and 1 of shape (H, W, C)
Expand All @@ -32,7 +29,6 @@ alg = FastReflectionRemoval(h = 0.11)
# run the algorithm and get result of shape (H, W, C)
dereflected_img = alg.remove_reflection(img)


...
```

Expand All @@ -56,27 +52,21 @@ dereflected_img = alg.remove_reflection(img)
```

## How to run the project
To run the project, we need to run script bin/run.py. The important parameters of this script are:
- ***h***: larger h leads to more reflections removed, but the result image will be blurrier,
- ***input_path***: path to the input image,
- ***output_path***: path to the output image.

Example:
```bash
# activate the environment
source venv/bin/activate # on Windows ./venv/Scripts/activate.ps1 in Powershell
python bin/run.py --h=0.11 --input_path="docs/toy_example.jpg" --output_path="docs/toy_example_out.jpg"
frr ".\tests\test_frr\fixtures\toy_example.jpg" "out.jpg" -h 0.11
```

The program, in this example, loads input image from the path docs/toy_example.jpg, processes it with parameter h=0.11 and outputs it into docs/toy_example_out.jpg.
The program, in this example, loads input image from the path `.\tests\test_frr\fixtures\toy_example.jpg`, processes it with parameter `h=0.11` and outputs it into `out.jpg`. More information about the parameters can be obtained by invoking `frr --help`.


## Project structure
Folders:
- *bin*: executable python files.
- *docs*: documentation.
- *src*: contains list of folders for sources, e.g. python.
- *tests*: follows the structure of src/python.
- *tests*: tests that follow the structure of src/python.

## Credits
This repository implements paper [Fast Single Image Reflection Suppression via Convex Optimization](https://arxiv.org/pdf/1903.03889.pdf) authored by Yang Yang, Wenye Ma, Yin Zheng, Jian-Feng Cai and Weiyu Xu.
2 changes: 1 addition & 1 deletion src/python/frr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@click.command()
@click.argument("input-path", type=click.Path())
@click.option("--output-path", default="out.png", type=click.Path(), help="An optional output path.")
@click.argument("output-path", type=click.Path())
@click.option("-h", default=0.03, type=click.FloatRange(0, 1), help="Measures how strong reflection removal is going to be. Higher h means stronger dereflection.")
@click.option("--debug", is_flag=True, help="If True, then the debug outputs are printed into out/.")
def main(input_path, output_path, h, debug):
Expand Down
Empty file removed tests/.keep
Empty file.

0 comments on commit f64ab65

Please sign in to comment.