Here you can find the source of colorDistance(double r1, double g1, double b1, double r2, double g2, double b2)
Parameter | Description |
---|---|
r1 | first red |
g1 | first green |
b1 | first blue |
r2 | second red |
g2 | second green |
b2 | second blue |
public static double colorDistance(double r1, double g1, double b1, double r2, double g2, double b2)
//package com.java2s; /****************************************************************************** * The contents of this file are subject to the Compiere License Version 1.1 * ("License"); You may not use this file except in compliance with the License * You may obtain a copy of the License at http://www.compiere.org/license.html * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License. * The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial * Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke * are Copyright (C) 1999-2005 Jorg Janke. * All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved. * Contributor(s): ______________________________________. *****************************************************************************/ public class Main { /**//from w w w . j av a2 s . c o m * Simple Color Distance. * (3d point distance) * @param r1 first red * @param g1 first green * @param b1 first blue * @param r2 second red * @param g2 second green * @param b2 second blue * @return 3d distance for relative comparison */ public static double colorDistance(double r1, double g1, double b1, double r2, double g2, double b2) { double a = r2 - r1; double b = g2 - g1; double c = b2 - b1; return Math.sqrt(a * a + b * b + c * c); } }