如何使用搜索栏使用rgb颜色设置相机白平衡

时间:2016-08-22 11:49:27

标签: android camera seekbar

动态摄像机参数设置,如果此时改变搜索条值增加和减少白平衡值。以编程方式更改白平衡值更改。

1 个答案:

答案 0 :(得分:1)

mWhiteBallance.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
            Camera.Parameters param;
            param = camera.getParameters();
            // modify parameter
            Log.d(" Progress ", " >> > > >>> " + i);

            if (i == 0) {
                param.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_INCANDESCENT);
            } else if (i == 10) {
                param.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_FLUORESCENT);
            } else if (i == 20) {
                param.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_AUTO);
            } else if (i == 30) {
                param.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_DAYLIGHT);
            } else if (i == 40) {
                param.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_CLOUDY_DAYLIGHT);
            }

            camera.setParameters(param);
            Log.i(" Progress ", "Supported White Balance Modes:" + param.getWhiteBalance().toString());
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {

        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {

        }
    });