Here you can find the source of convertRGBtoYIQ(float[] rgb, float[] yiq)
Parameter | Description |
---|---|
rgb | The array of RGB components to convert |
yiq | An array to return the colour values with |
public static void convertRGBtoYIQ(float[] rgb, float[] yiq)
//package com.java2s; /***************************************************************************** * J3D.org Copyright (c) 2000 * Java Source * * This source is licensed under the GNU LGPL v2.1 * Please read http://www.gnu.org/copyleft/lgpl.html for more information * ****************************************************************************/ public class Main { /**/* ww w . j a v a2 s . c o m*/ * Change an RGB color to YIQ (JPEG) color. The colour value conversion is * independent of the colour range. Colours could be 0-1 or 0-255. * * @param rgb The array of RGB components to convert * @param yiq An array to return the colour values with */ public static void convertRGBtoYIQ(float[] rgb, float[] yiq) { float r = rgb[0]; float g = rgb[1]; float b = rgb[2]; yiq[0] = (0.299900f * r) + (0.587000f * g) + (0.114000f * b); yiq[1] = (0.595716f * r) - (0.274453f * g) - (0.321264f * b); yiq[2] = (0.211456f * r) - (0.522591f * g) + (0.311350f * b); } }