Rgb Color To Yiq - Java Algorithm

Java examples for Algorithm:Color

Description

Rgb Color To Yiq

Demo Code



public class RgbToYiq {
    public static void main(String args[]) {
        double yiq[][] = new double[3][1];
        double rgb[][] = new double[3][1];

        double fc[][] = { { 0.299, 0.587, 0.114 },
                { 0.596, -0.275, -0.321 }, { 0.212, -0.523, 0.311 } };
        double sum = 0;
        for (int i = 0; i < fc[0].length; i++) {
            for (int j = 0; j < 1; j++) {
                for (int k = 0; k < 3; k++) {
                    sum = sum + fc[i][k] * rgb[k][j];
                }/*from w  ww  .  ja  v a2 s.co  m*/
                yiq[i][j] = sum;
                sum = 0;
            }
        }

        for (int i = 0; i < yiq.length; i++) {

        }

    }
}

Related Tutorials