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
- Extract RGB Color From a Image Using CV2
- OLTP vs. OLAP Databases: Advanced Insights and Query Optimization Techniques
- Google’s Core Update in May 2020: What You Need to Know
- The Beginner’s Guide to Normalization and Denormalization in Databases
- How AI Companies Are Making Humans Fools and Exploiting Their Data
- Quantum AI – The Future of AI Powered by Quantum Computing
- Create Virtual Host for Nginx on Ubuntu (For Yii2 Basic & Advanced Templates)
- Career Guide: Natural Language Processing (NLP)
- Internet of Things (IoT) & AI – Smart Devices and AI Working Together
- The Ultimate Guide to Data Science: Everything You Need to Know
Prepare for Interview
- 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
- Dynamic Programming and Recursion in Python
- Trees and Graphs 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