1

I have an issue when getting the previous color temperature of the picture taken and seting on the next picture using camera2 API.

if ( nbOfPict > 0 ){
       builder.set( CaptureRequest.CONTROL_AWB_MODE, CameraMetadata.CONTROL_AWB_MODE_OFF );
       builder.set( CaptureRequest.COLOR_CORRECTION_MODE, CameraMetadata.COLOR_CORRECTION_MODE_TRANSFORM_MATRIX );
       builder.set( CaptureRequest.COLOR_CORRECTION_TRANSFORM, characteristics.get( CameraCharacteristics.SENSOR_CALIBRATION_TRANSFORM1 ) );
       builder.set( CaptureRequest.COLOR_CORRECTION_GAINS, colorTemperature );
}

and on the capture result

if ( nb == 0 ) {
       colorTemperature = result.get(CaptureResult.COLOR_CORRECTION_GAINS);
}

but after the second picture taken, the result picture became green like this on Huawei only, I don't know why. This post also have green picture but doesn't explain why.

shirley
  • 10,698
  • 8
  • 25
  • 48
sdkgbsd
  • 13
  • 4

1 Answers1

0

You should also use the value of COLOR_CORRECTION_TRANSFORM from CaptureResult like you do with COLOR_CORRECTION_GAINS instead of using SENSOR_CALIBRATION_TRANSFORM1; the latter is meant for processing RAW images, not for using as a valid COLOR_CORRECTION_TRANSFORM.

You could also consider simply locking AWB until you're done capturing images.

Eddy Talvala
  • 16,372
  • 2
  • 38
  • 43
  • I couldn't get the colour correction transformation to work, but the AWB lock works, I wonder if my application will change the white balance before the AWB lock and after the first photo as mention in the documentation. – sdkgbsd Jul 23 '21 at 10:33