图像的算法其实比较简单, 暂且不去追究这公式怎么来的,拿了用就行了

 

r = 0.393r +0.769g+0.189b
g = 0.349r + 0.686g +0.168b
b = 0.272r +0.534g +0.131b

 

 

r= (BYTE)max(0, min(255, 0.393*r + 0.769*g + 0.189*b));
g= (BYTE)max(0, min(255, 0.349*r + 0.686*g + 0.168*b));
b= (BYTE)max(0, min(255, 0.272*r + 0.534*g + 0.131*b));

 

 

 

 

posted on 2013-09-03 17:34  裴银祥的博客园  阅读(267)  评论(0编辑  收藏  举报