How to add real-time filtering effects to camera API 2 on Android

I am developing a camera application in android, I want to include a real-time filtering function in my application, I used the GPUimage filter to add filtering effects to the image. But I do not know how to enable real-time filtering effects to preview the camera before shooting. I used camera and camera 2 api for the version below the candy and for the version of lollipop. Is a library available for this? I'm a beginner, can anyone help?

+5
source share
2 answers

If you need simple filters like sepia or negative, you can simply set the CONTROL_EFFECT_MODE field in the CaptureRequest instance using the CaptureRequest.Builder mBuilder.set(CaptureRequest.CONTROL_EFFECT_MODE, /*your value*/); method mBuilder.set(CaptureRequest.CONTROL_EFFECT_MODE, /*your value*/);

see the doc developer for available values.

+4
source

yes, I agree with the comments above using

 mBuilder.set (CaptureRequest.CONTROL_EFFECT_MODE, / * your value * /); 

full documentation here

0
source

Source: https://habr.com/ru/post/1236699/


All Articles