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
- Understanding HTAP Databases: Bridging Transactions and Analytics
- Top 10 Knowledge for Machine Learning & Data Science Students
- How AI Companies Are Making Humans Fools and Exploiting Their Data
- SQL Joins Explained: A Complete Guide with Examples
- Python Challenging Programming Exercises Part 2
- Variable Assignment in Python
- Government Datasets from 50 Countries for Machine Learning Training
- Where to Find Free Datasets for Your Next Machine Learning & Data Science Project
- What to Do When Your MySQL Table Grows Too Wide
- Quantum AI – The Future of AI Powered by Quantum Computing
Prepare for Interview
- 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
- Dynamic Programming and Recursion in Python
- Trees and Graphs in Python
- Linked Lists, Stacks, and Queues in Python
Datasets for Machine Learning
- 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