Extract RGB Color From a Image Using CV2
Hi Everyone, We are Come Back with a New Post, In this post, We learn How to Extract RGB Color From an Image. In Simple Language Convert an Image Into Red, Green and Blue Color.
We Use CV2 Library for Extract RGB Color From an Image. There are Few Steps to Extract RGB Color from an Image.
- Import Library
- Read Image
- Split Image to RGB
- Show Image
Necessary Library
- CV2
- Numpy
#import library
import cv2
import numpy as np
#Read Image
img = cv2.imread('logo.png')
cv2.imshow('Output Image1', img)
cv2.waitKey(0)
#Split Image
B,G,R = cv2.split(img)
zero = np.zeros(img.shape[:2],dtype ='uint8')
cv2.imshow('Red', cv2.merge([zero,zero,R]))
cv2.waitKey(0)
cv2.imshow('Green', cv2.merge([zero,G,zero]))
cv2.waitKey(0)
cv2.imshow('Blue',cv2.merge([G,zero,zero]))
cv2.waitKey(0)
cv2.destroyAllWindows()
Download Source Code
Thanks for Reading Share this
Random Blogs
- OLTP vs. OLAP Databases: Advanced Insights and Query Optimization Techniques
- What to Do When Your MySQL Table Grows Too Wide
- Transforming Logistics: The Power of AI in Supply Chain Management
- What Is SEO and Why Is It Important?
- Government Datasets from 50 Countries for Machine Learning Training
- Understanding HTAP Databases: Bridging Transactions and Analytics
- Career Guide: Natural Language Processing (NLP)
- Mastering SQL in 2025: A Complete Roadmap for Beginners
- Understanding AI, ML, Data Science, and More: A Beginner's Guide to Choosing Your Career Path
- Python Challenging Programming Exercises Part 2
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


