public int GetMax(Color channel) {
        int treshhold = 5; // if value is above treshhold we do not account for it to minimize noise influence
        int[][] hist_value = Parent.Camera.GetHistogram(0);

        int ret = 255;
        if (channel == Color.red) {
            for (int i = hist_value[0].length - 1; i >= 0; i--) {
                if (hist_value[0][i] > treshhold) {
                    ret = i;
                    break;
                }
            }
        }
        if (channel == Color.green) {
            for (int i = hist_value[1].length - 1; i >= 0; i--) {
                if (hist_value[1][i] > treshhold) {
                    ret = i;
                    break;
                }
            }
        }
        if (channel == Color.blue) { // blue 
            for (int i = hist_value[2].length - 1; i >= 0; i--) {
                if (hist_value[2][i] > treshhold) {
                    ret = i;
                    break;
                }
            }
        }
        return ret;
    }