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
- How to Start Your Career as a DevOps Engineer
- Python Challenging Programming Exercises Part 1
- Datasets for Exploratory Data Analysis for Beginners
- Important Mistakes to Avoid While Advertising on Facebook
- Understanding HTAP Databases: Bridging Transactions and Analytics
- Avoiding the Beginner’s Trap: Key Python Fundamentals You Shouldn't Skip
- Datasets for Natural Language Processing
- OLTP vs. OLAP Databases: Advanced Insights and Query Optimization Techniques
- How AI is Making Humans Weaker – The Hidden Impact of Artificial Intelligence
- 15 Amazing Keyword Research Tools You Should Explore
Prepare for Interview
Datasets for Machine Learning
- 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