视频基础

发布于 2020-11-08  291 次阅读


综述

1 rgb
2 yuv

详细内容

RGB

三原色 RGB

limited rgb : 16 - 235
full rgb: 0 - 255

YUV

Y - limuence
Cb - blue
Cr - red

limited yuv :
full yuv :

HSL/HSB/HSV

//RGB - red green blue
t_rgb = (r,g,b);
t_rgb_max = max(t_rgb);
t_rgb_min = min(t_rgb);

//HSL - hue saturation lightness
t_hsl = (h,s,l)
if(t_rgb_max == t_rgb_min)
    t_hsl.h = 0;
if(t_rgb_max == t_rgb.r)
    t_hsl.h = 60*(t_rgb.g-t_rgb.b)/(t_rgb_max-t_rgb_min) + 360*(t_rgb.g-t_rgb.b>=0?0:1);
if(t_rgb_max == t_rgb.g)
    t_hsl.h = 60*(t_rgb.b-t_rgb.r)/(t_rgb_max-t_rgb_min) + 120
if(t_rgb_max == t_rgb.b)
    t_hsl.h = 60*(t_rgb.r-t_rgb.g)/(t_rgb_max-t_rgb_min) + 240

//HSV - hue saturation value
//HSB - hue saturation brightness

朝闻道,夕死可矣