Atitit 颜色平均值cloor grb hsv模式的区别对比
2016-11-12 18:49
281 查看
Atitit 颜色平均值cloor grb hsv模式的区别对比
使用hsv模式平均后会变得更加的靓丽一些。。2
public class imgT {
public static void main(String[] args) {
Color c = new Color(100, 250, 55);
Color c2 = new Color(69, 176, 216);
List<Color> li_c = Lists.newArrayList();
li_c.add(c);
li_c.add(c2);
Color c_avg = ColorUtil.avgClr_byLiClr(li_c);
HSV h = ColorUtil.rgb2hsv(c.getRGB());
HSV h2 = ColorUtil.rgb2hsv(c2.getRGB());
List<HSV> li_h = Lists.newArrayList();
li_h.add(h);
li_h.add(h2);
HSV h_avg = ColorUtil.avgHsv(li_h);
Color h2c=ColorUtil.HSVtoRGBColorV2(h_avg);
System.out.println(c_avg);
System.out.println(h_avg);
System.out.println(h2c);
}java.awt.Color[r=84,g=213,b=135]
{
"h":151,
"s":0.7302778,
"v":0.9137255,
"x":0,
"y":0
}
java.awt.Color[r=63,g=233,b=151]
public static Color avgClr_byLiClr(List<Color> li_c) {
int r_sum = 0;int g = 0;int b = 0;
//Color cl = null;
for (Color c1 : li_c) {
r_sum=c1.getRed()+r_sum;
g=c1.getGreen()+g;
b=c1.getBlue()+b;
}
int len=li_c.size();
int avg_r=r_sum/len;
int avr_g=g/len;
int avr_b=b/len;
//int rgb = .getRGB();
return new Color(avg_r, avr_g, avr_b);
//return avgClr(ca);
}
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 )
汉字名:艾提拉(艾龙), EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
Atiend
使用hsv模式平均后会变得更加的靓丽一些。。2
public class imgT {
public static void main(String[] args) {
Color c = new Color(100, 250, 55);
Color c2 = new Color(69, 176, 216);
List<Color> li_c = Lists.newArrayList();
li_c.add(c);
li_c.add(c2);
Color c_avg = ColorUtil.avgClr_byLiClr(li_c);
HSV h = ColorUtil.rgb2hsv(c.getRGB());
HSV h2 = ColorUtil.rgb2hsv(c2.getRGB());
List<HSV> li_h = Lists.newArrayList();
li_h.add(h);
li_h.add(h2);
HSV h_avg = ColorUtil.avgHsv(li_h);
Color h2c=ColorUtil.HSVtoRGBColorV2(h_avg);
System.out.println(c_avg);
System.out.println(h_avg);
System.out.println(h2c);
}java.awt.Color[r=84,g=213,b=135]
{
"h":151,
"s":0.7302778,
"v":0.9137255,
"x":0,
"y":0
}
java.awt.Color[r=63,g=233,b=151]
使用hsv模式平均后会变得更加的靓丽一些。。
/AtiPlatf_cms/src/com/attilax/img/other/ColorUtil.javapublic static Color avgClr_byLiClr(List<Color> li_c) {
int r_sum = 0;int g = 0;int b = 0;
//Color cl = null;
for (Color c1 : li_c) {
r_sum=c1.getRed()+r_sum;
g=c1.getGreen()+g;
b=c1.getBlue()+b;
}
int len=li_c.size();
int avg_r=r_sum/len;
int avr_g=g/len;
int avr_b=b/len;
//int rgb = .getRGB();
return new Color(avg_r, avr_g, avr_b);
//return avgClr(ca);
}
作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 )
汉字名:艾提拉(艾龙), EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
Atiend
相关文章推荐
- Atitit 颜色平均值cloor grb hsv模式的区别对比
- Atitit hsv转grb 应该优先使用hsv颜色原则 方便人类
- Atitit rgb yuv hsv HSL 模式和 HSV(HSB) 图像色彩空间的区别
- Atitit rgb yuv hsv HSL 模式和 HSV(HSB) 图像色彩空间的区别
- Atitit blend mode COLOR_DODGE 混合模式 “颜色减淡”模式
- Atitit orm的实现模式 data-mapper模式和active-record模式有什么区别
- Atitit blend mode COLOR_DODGE 混合模式 “颜色减淡”模式
- Atitit. 状态模式(State)attilax 总结 跟个策 略模式的区别
- Atitit. 状态模式(State)attilax 总结 跟个策 略模式的区别
- Atitit hsv转grb 应该优先使用hsv颜色原则 方便人类
- HSV颜色模式的应用
- atitit.(设计模式1)--—职责链(chain of responsibility)最佳实践O7 转换日期
- HSV颜色模式的应用
- atitit.设计模式(2) -----查询方式/ command 总结
- Atitit. 软件设计 模式 变量 方法 命名最佳实践 vp820 attilax总结命名表大全
- ART与Dalvik哪个好用 ART模式和Dalvik模式区别对比分析
- atitit.印度教与java宗教的特点与观念对比 attilax总结
- 【设计模式之四:工厂模式对比】简单工厂、工厂方法和抽象工厂的区别
- atitit.网络文件访问协议.unc smb nfs ftp http的区别
- HSI、HSV、RGB、CMYK、HSL、HSB、Ycc、XYZ、Lab、YUV颜色模型的区别