Reputation: 35
I am new to camera2 api to develop this module, I have jni files encoded in c and am developing a normal to b&w camera. The camera is like this when switch to b&w is anyone done this in camera2 api?
Upvotes: 0
Views: 1590
Reputation: 1170
Ok! So what you are looking for is to change the mode of your camera
In order to achieve this you can use Camera.Parameters,You can use the EFFECT_MONO(monochrome) from the color effects to get black & white images...
To make camera parameters take effect, applications have to call Camera#setParameters(Camera.Parameters)
.
For example, after Camera.Parameters#setWhiteBalance
is called, white balance is not actually changed until Camera#setParameters(Camera.Parameters)
is called with the changed parameters object. Below is a sample code for your reference
mCameraDevPara.setColorEffect(android.hardware.Camera.Parameters.EFFECT_MONO);
mCameraDev.setParameters(mCameraDevPara);
For camera2api these you can achieve by CaptureRequest
, it has method CONTROL_EFFECT_MODE
A special color effect to apply.
When this mode is set, a color effect will be applied to images produced by the camera device. The interpretation and implementation of these color effects is left to the implementor of the camera device, and should not be depended on to be consistent (or present) across all devices.
For more ref GO here.
Tip: Different devices may have different camera capabilities, such as picture size or flash modes. The application should query the camera capabilities before setting parameters. For example, the application should call
Camera.Parameters#getSupportedColorEffects()
before calling
Camera.Parameters#setColorEffect(String)
. If the camera does not support color effects,
Camera.Parameters#getSupportedColorEffects()
will return null.
Upvotes: 1