Python#RGB-HSV-YCrBr-CMY

import cv2
import numpy as np


def RGB_CMY(img):
    b, g, r = cv2.split(img) 	# split the channels
    M = 1 - b
    Y = 1 - g
    C = 1 - r
    result = cv2.merge((C, M, Y)) 	# merge the channels
    cv2.imshow("C channel", C)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    cv2.imshow("M channel", M)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    cv2.imshow("Y channel", Y)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    return result




sch = cv2.imread("/Users/Schwinn/Desktop/1.jpg")
i1=RGB_CMY(sch)
i2=RGB_HSV(sch)
i3=RGB_YCbCr(sch)
cv2.imshow("Kobe1", i1)
cv2.imshow("Kobe2", i2)
cv2.imshow("Kobe3", i3)
cv2.imshow("Kobe", sch)
cv2.waitKey(0)
cv2.destroyAllWindows()
RGB_CMY(sch)
RGB_HSV(sch)
RGB_YCbCr(sch)

1.CMY

Cyan

Magneta

Yellow

 

猜你喜欢

转载自blog.csdn.net/Iverson941112/article/details/83243963