private void convertRGBtoYCbCr() {
        int R;
        int G;
        int B;
        yCbCrArray = new double[height][width][3];
        for (int row = 0; row < height; row++) {
            for (int col = 0; col < width; col++) {
                R = rgbArray[row][col][0];
                G = rgbArray[row][col][1];
                B = rgbArray[row][col][2];
                yCbCrArray[row][col][0] = (0.299 * R + 0.587 * G + 0.114 * B); // Y channel
                yCbCrArray[row][col][1] = (128 - (0.168736 * R) - (0.331264 * G) + 0.5 * B); // Cb channel
                yCbCrArray[row][col][2] = (128 + (0.5 * R) - (0.418688 * G) - 0.081312 * B); // Cr channel
            }
        }
    }