How to Use Different Color Codes in OpenCV

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

import cv2
import matplotlib.pyplot as plt
img=cv2.imread("D://opencvapp//wildlifeImages//wildlife-tiger.jpg")
cv2.imshow('Origal Image ',img)
#BGR to RGB
rgb=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
cv2.imshow('RGB in OpenCV Image ',rgb)
plt.imshow(rgb)
plt.show()

# #BGR to Gray
# gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# cv2.imshow('Gray Image ',gray)
# #BGR to HSV
# hsv=cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
# cv2.imshow('HSV Image ',hsv)
# #BGR to LAB
# lab=cv2.cvtColor(img,cv2.COLOR_BGR2LAB)
# cv2.imshow('LAB Image ',lab)
# cv2.waitKey(0)
# cv2.destroyAllWindows()

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses
Image

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *