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
- Government Datasets from 50 Countries for Machine Learning Training
- Datasets for Natural Language Processing
- Extract RGB Color From a Image Using CV2
- Important Mistakes to Avoid While Advertising on Facebook
- Where to Find Free Datasets for Your Next Machine Learning & Data Science Project
- Career Guide: Natural Language Processing (NLP)
- AI & Space Exploration – AI’s Role in Deep Space Missions and Planetary Research
- Understanding HTAP Databases: Bridging Transactions and Analytics
- Exploratory Data Analysis On Iris Dataset
- Best Platform to Learn Digital Marketing in Free
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