Thursday 29 July 2021

How can I change the whiteBalance gains value in android?

I would like to get the value of the current gains and change the value of the RGB gains.

In iOS, Apple provides setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler.

- (void)setWhiteBalanceGains:(AVCaptureWhiteBalanceGains)gains
{
  NSError *error = nil;
  
  if ( [self.captureDevice lockForConfiguration:&error] ) {
    AVCaptureWhiteBalanceGains normalizedGains = [self normalizedGains:gains];
    [self.captureDevice setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:normalizedGains completionHandler:nil];
    [self.captureDevice unlockForConfiguration];
  }
  else {
    NSLog( @"Could not lock device for configuration: %@", error );
  }
}

- (AVCaptureWhiteBalanceGains)normalizedGains:(AVCaptureWhiteBalanceGains) g
{
  AVCaptureWhiteBalanceGains gains = g;
  gains.redGain = MAX(gains.redGain, 1.0f);
  gains.greenGain = MAX(gains.greenGain, 3.0f);
  gains.blueGain = MAX(gains.blueGain, 18.0f);
  
  return gains;
}

How can we achieve this in android using cameraX?

COLOR_CORRECTION_GAINS

COLOR_CORRECTION_MODE

I have checked in the doc regarding channel control. But how can we change color correction and reset the cameraX preview with the new control?



from How can I change the whiteBalance gains value in android?

No comments:

Post a Comment