Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using the OpenCV Tutorial 3 code (Camera Control) (see OpenCV4Android samples) I modified the colour effects methods to allow the setting of white balance:

public List<String> getWhiteBalanceList() {
    return mCamera.getParameters().getSupportedWhiteBalance();
}

public boolean isWhiteBalanceSupported() {
    return (mCamera.getParameters().getWhiteBalance() != null);
}

public String getWhiteBalance() {
    return mCamera.getParameters().getWhiteBalance();
}

public void setWhiteBalance(String whiteBalance) {
    Camera.Parameters params = mCamera.getParameters();
    params.setWhiteBalance(whiteBalance);
    mCamera.setParameters(params);
}

Once I knew that worked I was able to add a call to my main thread to set the correct white balance:

mOpenCvCameraView.setWhiteBalance(Parameters.WHITE_BALANCE_CLOUDY_DAYLIGHT);