Convert RBG Image to Gray Scale Image Using CV2

Hi Everyone, In this Post, We Will Learn How to Convert a Simple RBG Image to Gray Scale Image It's Very easy to convert any image into grayscale image using Python CV2 Library. So Now Let's Start How We Can do this, Follow the Post Until End.
We Use Two Method for Convert Image into Gray Scale Image.
First Method
import cv2
img = cv2.imread('logo.png')
cv2.imshow('output ', img)
cv2.waitKey(0)
grey_scale = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow('Greyscale', grey_scale)
cv2.waitKey(0)
cv2.destroyAllWindows()
Output
Second Method
import cv2
img = cv2.imread('logo.png', 0)
cv2.imshow('Grey Scale Image ', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Output
Download Source Code
Thanks for Reading Share this
Random Blogs
- What to Do When Your MySQL Table Grows Too Wide
- Understanding SQL vs MySQL vs PostgreSQL vs MS SQL vs Oracle and Other Popular Databases
- Understanding HTAP Databases: Bridging Transactions and Analytics
- Exploratory Data Analysis On Iris Dataset
- Google’s Core Update in May 2020: What You Need to Know
- How AI is Making Humans Weaker – The Hidden Impact of Artificial Intelligence
- Datasets for Natural Language Processing
- The Ultimate Guide to Data Science: Everything You Need to Know
- Data Analytics: The Power of Data-Driven Decision Making
- How to Install Tableau and Power BI on Ubuntu Using VirtualBox
Prepare for Interview
- JavaScript Interview Questions for 5+ Years Experience
- JavaScript Interview Questions for 2–5 Years Experience
- JavaScript Interview Questions for 1–2 Years Experience
- JavaScript Interview Questions for 0–1 Year Experience
- JavaScript Interview Questions For Fresher
- SQL Interview Questions for 5+ Years Experience
- SQL Interview Questions for 2–5 Years Experience
- SQL Interview Questions for 1–2 Years Experience
- SQL Interview Questions for 0–1 Year Experience
- SQL Interview Questions for Freshers
- Design Patterns in Python
Datasets for Machine Learning
- Awesome-ChatGPT-Prompts
- Amazon Product Reviews Dataset
- Ozone Level Detection Dataset
- Bank Transaction Fraud Detection
- YouTube Trending Video Dataset (updated daily)
- Covid-19 Case Surveillance Public Use Dataset
- US Election 2020
- Forest Fires Dataset
- Mobile Robots Dataset
- Safety Helmet Detection
- All Space Missions from 1957
- OSIC Pulmonary Fibrosis Progression Dataset
- Wine Quality Dataset
- Google Audio Dataset
- Iris flower dataset
- Artificial Characters Dataset
- Bitcoin Heist Ransomware Address Dataset