diff --git a/README.md b/README.md index d2930c4..fe47061 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,17 @@ +This repo was forked from https://github.com/TimManiquet/occlusion + # Occlusion of Images This repository contains three Python scripts to apply occlusion to a set of images in different ways. The three ways of occluding images are: by adding **blobs** on top of images, by adding a **partial viewing** mask with apertures on top of the images, or by **deleting** parts of the images. Each of these manipulations, occludes objects in the images such that only a _certain proportion_ of them will remain visible. +

+Manipulations example +

+ ## Input images To ensure that the occluded proportion is calculated correctly, make sure the input images contain an transparent mask (alpha channel) where the object is delineated from the background. These images should be 4-channel, grayscale images. Example of such images can be found in the `input images` folder. @@ -12,6 +23,14 @@ To ensure that the occluded proportion is calculated correctly, make sure the i - glob - os +## Installation + +To install this package using pip, first ensure that you have Git installed on your system. Then, create a new virtual environment and activate it. Finally, run the following command: + +```pip install git+https://github.com/TimManiquet/occlusion.git@v0.1``` + +You can also just clone or download the repo (see below) + ## Usage 1. Clone or download this repository. 2. Place the images to occlude in the `img_dir` folder. @@ -75,17 +94,28 @@ occlude( ``` -This example applies different level and types of occlusion to the images in the `input_dir` folder. The resulting occluded images will be saved in the `output_images` folder. An example output object from this command is found below: +This example applies different level and types of occlusion to the images in the `input_dir` folder. The resulting occluded images will be saved in the `output_images` folder.This example script can be found in the `data` folder, along with a jupyter notebook showing different manipulations. -Alt text +## Outputs +Below are example output images from different commands. +```blobs("path/to/cat.png", easy=10, hard=50, many_small=True, col=255)``` -## Installation +

+ +

-To install this package using pip, first ensure that you have Git installed on your system. Then, create a new virtual environment and activate it. Finally, run the following command: +```deletion("path/to/building.png", easy=40, hard=70, many_small=True, few_large=True)``` -```pip install git+https://github.com/TimManiquet/occlusion.git@v0.1``` +

+ +

+

+ +

+ +```partial_viewing("path/to/bird.png", easy=20, hard=90, many_small=False, few_large=True, seed=10)``` + +

+ +

diff --git a/demo.ipynb b/data/demo.ipynb similarity index 99% rename from demo.ipynb rename to data/demo.ipynb index 2c43e3e..4b06499 100644 --- a/demo.ipynb +++ b/data/demo.ipynb @@ -6,7 +6,7 @@ "source": [ "## [Occlude images](#toc0_)\n", "\n", - "This notebook illustrates how to use the functions contained in this repository. " + "This notebook illustrates how to use the functions contained in this repository. To run this notebook, clone the repository and place the notebook in the root folder, or install the repo using git (see Installation on the README file)." ] }, { diff --git a/example.py b/data/example.py similarity index 100% rename from example.py rename to data/example.py diff --git a/data/manipulations.png b/data/manipulations.png new file mode 100644 index 0000000..6d851e3 Binary files /dev/null and b/data/manipulations.png differ