Python 3 (OpenCV + Numpy) Script to Extract Dominant Color in RGB Hex Code From Image File Full Project For Beginners

You are currently viewing Python 3 (OpenCV + Numpy) Script to Extract Dominant Color in RGB Hex Code From Image File Full Project For Beginners

 

Welcome folks today in this blog post we will be extracting dominant color in rgb hex code from image file in python using opencv and numpy library. All the source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install numpy

 

pip install opencv-python

 

After installing these libraries make an app.py file and copy paste the following code

 

app.py

 

 

 

Now if you execute this python script by typing the below command

 

python app.py

 

 

 

As you can see it asks for the path of the image we provide the image as input and then it returns the dominant color which is present in image in the form of RGB hex code and also return tone information about image

Leave a Reply