A package that can be used to remove any particular color from an image in Python. A Basic GUI for openCV is also provided in python.
A package that can be used to remove particular color from an image in Python.
/Note:/ Better to use GUI as it uses openCV which is majorly supported.
RAW CODE ONLY : (ColorRemoval.py)
python -m pip install --upgrade Pillow
GUI ONLY : (GUI.py)
pip install opencv-python
pip install PySimpleGUI
import ColorRemoval
input_image_path = 'input_image.jpg' # Replace with the path to your input image
output_image_path = 'output_image.png' # Replace with the desired output path
target_color = (255, 0, 0) # Replace with the RGB color you want to remove
ColorRemoval.remove_color_from_image(input_image_path, output_image_path, target_color)
input_image.jpg
>> When target_color == "RED" or (255,0,0)
>> When target_color == "GREEN" or (0,255,0)
>> When target_color == "BLUE" or (0,0,255)
> GUI window
Original image:
GreyScaled:
Add > (200,0,0) "RED"
Sub > (200,0,0) "RED"
Filter >
lower_bound = (0,0,0) "black"
upper_bound = (0,255,255) "not red" or "all except red color i.e. blue and green"
Convolutions > Blur
Convolutions > Sharpen
Submitted by Lakshay Sharma (LakshaySharma)
Download packets of source code on Coders Packet
Comments