Python program used to easily color isolate a specific part of a picture.
color_isolation.py
is a Python program leveraging OpenCV and its HSV filtering
capabilities to color isolate a specific part of a picture.
Here are the consecutive process steps:
- The user executes the program and the HSV version of the input picture appears
- The user clicks 5 times on several places on the object he wants to color isolate. This step allows to record samples of HSV values
- Based on these values, an average of the HSV values will be elaborated and the HSV range is computed
- Using the HSV range and the
cv2.inRange
function, the mask isolating the object of interest is created - Using the same mask, the region of the object of interest is black-outed from a grayscaled version of the input picture and the original colored object is added at this precise location
- Tested on macOS Big Sur version 11.0.1
- Python 3.7
For testing color_isolation.py
, install the required packages by typing
following Terminal command at the root of the project:
pip install -r requirements.txt
The color_isolation.py
script can be run by typing following Terminal command
at the root of the project:
python3.7 color_isolation.py
- 0.1
- Initial release