From b743bd30b684bde2a7a9cfd39da43cf7d88db3b5 Mon Sep 17 00:00:00 2001 From: Ian Andwati Date: Thu, 15 Jun 2023 09:18:00 +0300 Subject: [PATCH] Modified README.md --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ sorter/image_sorter.py | 2 ++ 2 files changed, 43 insertions(+) diff --git a/README.md b/README.md index f54fe2c..854a8e2 100644 --- a/README.md +++ b/README.md @@ -1 +1,42 @@ # Image sorter + +# Installation + +Requires `python >=3.7` + +1. Create a python virtual environment + +``` +python -m venv venv +``` + +2. Activate the virtual environment + +``` +./venv/Scripts/activate +``` + +3. Install dependencies + +``` +pip install -r requirements.txt +``` + +# How to use + +--source" help="Path to the input folder containing the images" + +--destination" help="Path to the pass folder for images that pass the test" + +--rejects help="Path to the reject folder for images that fail the test" + +``` +python cli.py --source --destination --rejects +``` + +# TODO + +- Sort images according to size +- Remove black or blank images +- Remove white/gray images +- Use multithreading to increase performance diff --git a/sorter/image_sorter.py b/sorter/image_sorter.py index 725d02c..80ae96e 100644 --- a/sorter/image_sorter.py +++ b/sorter/image_sorter.py @@ -15,6 +15,8 @@ def process_image(image_path,pass_folder,reject_folder): filename = image_path.name image = cv2.imread(str(image_path)) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + + # threshold(src, dst, threshold value, max value, threshold type) _, threshold = cv2.threshold(gray, threshold_value, max_value, threshold_type)