2020
10-23
10-23
Python+OpenCV图像处理—— 色彩空间转换
一、色彩空间的转换代码如下:#色彩空间转换importcv2ascvdefcolor_space_demo(img):gray=cv.cvtColor(img,cv.COLOR_BGR2GRAY)#RGB转换为GRAY这里的GRAY是单通道的cv.imshow("gray",gray)hsv=cv.cvtColor(img,cv.COLOR_BGR2HSV)#RGB转换为HSVcv.imshow("hsv",hsv)yuv=cv.cvtColor(img,cv.COLOR_RGB2YUV)#RGB转换为YUVcv.imshow("yuv",yuv)Ycrcb=cv.cvtColor(img,cv.COLOR_RGB2YCrCb)#RGB...
继续阅读 >