Package de.mpi.rgblab.color

Examples of de.mpi.rgblab.color.ColorModel


    System.out.println(color);
    getColorSelectionModel().setSelectedColor(color);
   
  }
  private void updateHCL(float h,float c, float l){
    ColorModel lch = new ColorModel(l,c,h,ColorType.LCH_uv);
    if (!isAdjusting){
      isAdjusting = true;
      Color color = ColorModel.getColor(ColorTransformer.lch_uv2rgb(lch));
     
       getColorSelectionModel().setSelectedColor( color );
View Full Code Here


              int  color = 0;
           
              for (int i=0;i<row.length;++i,++j){
               
                if (i==0 || j>=quot){
                ColorModel myLCH = new ColorModel(l,x,h,ColorType.LCH_uv);
                color =  ColorModel.getRGBColor( ColorTransformer.lch_uv2rgb(myLCH));
                x++;
                j = 0;
                }
                //System.out.println("CSlider Color ["+i+"]="+new Color(color));
                row[i] = color;
              }
            }
            else if (type == LSLIDER){
           
             
              int quot = Math.round((float)row.length/MAX_LIGHTNESS_VALUE);
              int j=0;
              int x = 0;
              int  color = 0;
              for (int i=0;i<row.length;++i,++j){
               
                if (i==0 || j>=quot){
                ColorModel myLCH = new ColorModel(x,c,h,ColorType.LCH_uv);
                color =  ColorModel.getRGBColor( ColorTransformer.lch_uv2rgb(myLCH));
                x++;
                j = 0;
                }
                row[i] = color;
View Full Code Here

    // copy the the vector to an array
    ColorModel[] my_rgbColor = new ColorModel[rgbColors.size()];
    rgbColors.copyInto(my_rgbColor);

    // transform to lab space
    ColorModel labColor[] = ColorTransformer.rgb2lab(my_rgbColor);

    // delete the old elements
    if (false == labColors.isEmpty())
      labColors.removeAllElements();
    // array to vector
View Full Code Here

    if (lab.getDimension_3() > B_MAX)
      return false;
    if (lab.getDimension_3() < B_MIN)
      return false;
   
    ColorModel rgb = ColorTransformer.lab2rgb(lab);
    double c;
   
    for (int i = 0; i < 3; i++) {
      c = rgb.getDimension(i);
      if (c > 255 || c < 0)
        return false;
    }
    return true;
  }
View Full Code Here

    double l = -127.87431826763529;
    double a = -617.8203664542718;
    double b = 339.6924724930096;
   
    //for (int i = 0; i < 105; i++)
      System.out.println(isInRGBSpace(new ColorModel(l, a, b,
          ColorType.LAB)));
  }
View Full Code Here

      double n2 = in.nextDouble();
      double n3 = in.nextDouble();
     
     
      //fails
      ColorModel rgb = ColorTransformer.xyz2rgb(ColorTransformer.lab2xyz(new ColorModel(n1, n2, n3, ColorType.LAB)));
      //ok
      //ColorModel rgb = ColorTransformer.lab2xyz(new ColorModel(n1, n2, n3, ColorType.LAB));
     
      //fails
      //ColorModel rgb = ColorTransformer.rgb2xyz(new ColorModel(n1, n2, n3, ColorType.RGB));
      System.out.println(rgb.getDimension_1());
      System.out.println(rgb.getDimension_2());
      System.out.println(rgb.getDimension_3());
     
      System.out.println("end");
   
    }
  }
View Full Code Here

  }

  private Vector<ColorModel> arrayToColorModelVector(Color[] colors) {
    Vector<ColorModel> v = new Vector<ColorModel>();
    for (int i = 0; i < colors.length; i++)
      v.add(new ColorModel(colors[i].getRed(), colors[i].getGreen(),
          colors[i].getBlue(), ColorType.RGB));
    return v;
  }
View Full Code Here

  }

  private Vector<ColorModel> arrayToColorModelVector(Vector<Color> colors) {
    Vector<ColorModel> v = new Vector<ColorModel>();
    for (int i = 0; i < colors.size(); i++)
      v.add(new ColorModel(colors.get(i).getRed(), colors.get(i)
          .getGreen(), colors.get(i).getBlue(), ColorType.RGB));
    return v;
  }
View Full Code Here

      // set the color

      // new code - show the map with the input colors
      if (reason == -1) {

        ColorModel currentColorModel = classColors.get(l);
        Color currentColor = new Color((int) currentColorModel
            .getDimension_1(), (int) currentColorModel
            .getDimension_2(), (int) currentColorModel
            .getDimension_3());
        g.setColor(currentColor);

        // Dimension screenSize =
        // Toolkit.getDefaultToolkit().getScreenSize();

        if (sector == -1)
          g.drawRect(x + offsetWidth, y
              + offsetHeight, 1, 1);
        else if (l == sector)
          g.drawRect(x + offsetWidth, y
              + offsetHeight, 1, 1);

      }
      // compute saliency
      else if (reason == 0) {
        currentSaliency = data.getSaliency().get(count);

        float current_color_double = (float) (this.clr.size()
            * (currentSaliency - data.getMinSaliency()) / (data
            .getMaxSaliency() - data.getMinSaliency()));
        int current_color = (int) (current_color_double);
        if (current_color >= clr.size())
          current_color = clr.size() - 1;

        g.setColor(clr.get(current_color));

        if (sector == -1)
          g.drawRect(x + offsetWidth, y
              + offsetHeight, 1, 1);

        else if (current_color == sector)
          g.drawRect(x + offsetWidth, y
              + offsetHeight, 1, 1);

      }
      // identify bad visibility
      else if (reason == 1) {
        // old code

        currentSaliency = data.getSaliency().get(count);

        if (currentSaliency > threshold) {
          ColorModel currentColorModel = classColors.get(l);
          Color currentColor = new Color((int) currentColorModel
              .getDimension_1(), (int) currentColorModel
              .getDimension_2(), (int) currentColorModel
              .getDimension_3());
          g.setColor(currentColor);

          // Dimension screenSize =
          // Toolkit.getDefaultToolkit().getScreenSize();
View Full Code Here

 
  public static boolean test_compute_cov_matrix() {
    System.out.println("test_compute_cov_matrix");
    boolean b = true;
   
    ColorModel c1 = new ColorModel(1, 2, 3);
    ColorModel c2 = new ColorModel(4, 5, 6);
    ColorModel c3 = new ColorModel(7, 8, 19);
   
    Vector v = new Vector();
    v.add(c1);
    v.add(c2);
    v.add(c3);
View Full Code Here

TOP

Related Classes of de.mpi.rgblab.color.ColorModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.