Learning immediately: https://edu.csdn.net/course/play/26281/327071?utm_source=blogtoedu
In 1.OpenCV, BGR default format color image, three-channel color order of B, G, R, corresponding 0,1,2 index
2.OpenCV, in the range HSI / HSV color space is H 0-180, 0-255 other two are
3.HSV / HSI: V is the maximum value of RGB inside, v = max (r, g, b); it is an average value, I = (r + g + b) / 3;
import cv2 as cv
filename= "d:/lena.jpg"
img=cv.imread(filename)
gray=cv.cvtColor(img, cv.COLOR_BGR2GRAY)
cv.imshow("source image!", img)
cv.imshow("gray image", gray)
cv.waitKey()
hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)
cv.imshow("hue", hsv[:,:,0])
cv.imshow("saturation", hsv[:,:,1])
cv.imshow("value", hsv[:,:,2])
cv.waitKey()
cv.imshow("blue", img[:,:,0])
cv.imshow("green", img[:,:,1])
cv.imshow("red", img[:,:,2])
cv.waitKey()
cv.destroyAllWindows()