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
- OLTP vs. OLAP Databases: Advanced Insights and Query Optimization Techniques
- How AI Companies Are Making Humans Fools and Exploiting Their Data
- Top 15 Recommended SEO Tools
- How AI is Making Humans Weaker – The Hidden Impact of Artificial Intelligence
- Internet of Things (IoT) & AI – Smart Devices and AI Working Together
- How to Become a Good Data Scientist ?
- Career Guide: Natural Language Processing (NLP)
- Important Mistakes to Avoid While Advertising on Facebook
- Datasets for Natural Language Processing
- Role of Digital Marketing Services to Uplift Online business of Company and Beat Its Competitors
Prepare for Interview
- 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
- Sorting and Searching in Python
- Debugging in Python
- Unit Testing 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