zoukankan      html  css  js  c++  java
  • Atitit 颜色平均值cloor grb hsv模式的区别对比

    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]

     

     

     

     

    使用hsv模式平均后会变得更加的靓丽一些。。

    /AtiPlatf_cms/src/com/attilax/img/other/ColorUtil.java

    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

     

     

  • 相关阅读:
    UI/UE对个性化推荐的影响
    毫秒转换为天、小时、分、秒
    查生字
    探秘推荐引擎之协同过滤算法小综述
    给文献添加上标
    雅可比迭代和高斯赛德尔迭代
    广义二项式定理求解系数
    关于最大流的EdmondsKarp算法详解
    海量数据处理利器之布隆过滤器
    [leetcode] Path sum路径之和
  • 原文地址:https://www.cnblogs.com/attilax/p/6057316.html
Copyright © 2011-2022 走看看