@SuppressWarnings("empty-statement")
    public static Mat[] colorChannels(Mat frame) {
        Mat frames[] = new Mat[frame.channels()];

        for (int i = 0; i < frames.length; i++) {
            frames[i] = frame.clone();
        }

        int nl = frame.rows();
        int nc = frame.cols();
        double[] pixelVal = {0, 0, 0};
        double[] pixelTh = {0, 0, 0};
        for (int j = 0; j < nl; j++) {
            for (int i = 0; i < nc; i++) {
                pixelVal = frame.get(j, i);

                for (int f = 0; f < frames.length; f++) {
                    for (int c = 0; c < pixelVal.length; c++) {
                        if (f == c) {
                            pixelTh[c] = pixelVal[c];
                        } else {
                            pixelTh[c] = 0;
                        }
                    }
                    frames[f].put(j, i, pixelTh);
                }

            }
        }

        return frames;
    }