Closed developer-- closed 6 years ago
You should be able to do this with the .frameProcessor(myFrameProcessor) argument when creating your fotoapparat instance, or are you looking to do something else?
do you have any example of how to process this frame? I couldn't create bitmap from this frame, tried to get bytes from frame and than converting it to bitmap, but it returns null
@developer-- The bitmap is null because the image is in NV21 format. Check this to convert the byte[] to bitmap: https://stackoverflow.com/a/32793908/4148930
This library can help, https://github.com/silvaren/easyrs
But i am unable to figure out how to process the frame. I am trying to set the frame.image[] byte array to the new processed one, but as it's final variable i cannot set the value.. How am i supposed to do it then ?
This is my code by the way,
@Override
public void processFrame(Frame frame) {
Bitmap outputBitmap = Nv21Image.nv21ToBitmap(rs, frame.image, frame.size.width, frame.size.height);
Bitmap blurBitmap = Blur.blur(rs, outputBitmap, 20.0f);
Nv21Image nv21Image = Nv21Image.bitmapToNV21(rs, blurBitmap);
frame.image[] = nv21Image.nv21ByteArray[]; // This thing is not valid, what is the workaround ?
}
Editing a photo/video/surface/preview stream is another topic and nothing this library can do :) Hope you found your solution!
I want to add some filters in preview, like gamma and etc