Java Color Distance colorDistance(int r1, int g1, int b1, int r2, int g2, int b2)

Here you can find the source of colorDistance(int r1, int g1, int b1, int r2, int g2, int b2)

Description

color Distance

License

Open Source License

Declaration

private static double colorDistance(int r1, int g1, int b1, int r2, int g2, int b2) 

Method Source Code

//package com.java2s;

public class Main {
    private static double colorDistance(int r1, int g1, int b1, int r2, int g2, int b2) {
        double rmean = (r1 + r2) / 2;
        int r = r1 - r2;
        int g = g1 - g2;
        int b = b1 - b2;
        double weightR = 2 + rmean / 256;
        double weightG = 4.0;
        double weightB = 2 + (255 - rmean) / 256;
        return Math.sqrt(weightR * r * r + weightG * g * g + weightB * b * b);
    }/*from  w w  w .ja va2 s  .  c o  m*/
}

Related

  1. colordiffsq(int rgb0, int rgb1)
  2. colorDistance(double r1, double g1, double b1, double r2, double g2, double b2)
  3. colorDistance(final double r1, final double g1, final double b1, final double r2, final double g2, final double b2)
  4. colorDistance(final float[] lab1, final float[] lab2)
  5. colorDistance(final float[] lab1, final float[] lab2)
  6. distance(Color a, Color b)
  7. distance(Color c1, Color c2)
  8. distanceToColor(final int distance)
  9. drawArc(Point2D start, double distance, double startAngle, double arcAngle, boolean fill, Graphics2D g2, Color color)