Member-only story

Find Dominant Common Color With Telegram Bot

Amirhossein Douzandeh
2 min readDec 3, 2022

--

Find Dominant Common Color With Telegram Bot
Find Dominant Common Color With Telegram Bot

In the last few days, I decided to play with the telegram bot but I need to have a simple scenario for my application so I think “finding the most common colors” can be the best choice for me. So Let’s code:

👋 Initial Step

As a first step, You Need to run the below list of commands to install packages inside your virtual environment which helps you to start coding:

pip install opencv-python numpy matplotlib scikit-learn pyTelegramBotAPI

after that, we have to get the new token from BotFather to connect our application to the telegram. This step is so easy you just need to send a message to the bot that I told you about and follow the steps.

🎨 Color Clustering

To find the most common colors that exist inside a single picture, we need to export all the color codes and then cluster them by clustering algorithms like KMeans. To achieve this goal we use the below script:

🤖 Telegram Bot

--

--

Amirhossein Douzandeh
Amirhossein Douzandeh

Written by Amirhossein Douzandeh

Expert Front-End Developer 🎨 | A software engineer with a Master of Science in Computer Engineering 👨🏻‍💻 | focus on Artificial intelligence and ML 🧠

No responses yet

Write a response