natario1 / CameraView

📸 A well documented, high-level Android interface that makes capturing pictures and videos easy, addressing all of the common issues and needs. Real-time filters, gestures, watermarks, frame processing, RAW, output of any size.

Home Page:https://natario1.github.io/CameraView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

frameprocessor and javacv grabber

openmotion opened this issue · comments

Hello

i want to use javacv to encode in realtime the result of the frameprocessor
i cannot successfully convert the otalia Frame to the yuv of javacv
basically the demo of javacv is ok with the byte[]data of the onPreviewFrame of the basic example of android
https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java

so how can i have the same byte array format with the frameprocessor of the otaliastudios frameprocessor ?

here is my code

final byte[] bitmapbytes = frame.getData();
//Log.v(TAG,"recording_javacv : "+recording_javacv);
YuvImage yuvImage2 = new YuvImage(bitmapbytes, getFormat, frame.getSize().getWidth(), frame.getSize().getHeight(), null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
compression = 50;
Rect imageSizeRectangle = new Rect(0, 0, imageWidth, imageHeight);
yuvImage2.compressToJpeg(imageSizeRectangle, compression, baos);
byte[] imageData = baos.toByteArray();

and i put the result in
((ByteBuffer)yuvImage_javacv.image[0].position(0)).put(imageData);

and finally i do that :
recorder.record(yuvImage_javacv);

i tried to change the
mCameraView.setFrameProcessingFormat();

but not sure of the parameters
below this is the init of javacv.Frame
yuvImage_javacv = new org.bytedeco.javacv.Frame(imageWidth, imageHeight, org.bytedeco.javacv.Frame.DEPTH_UBYTE, 2);

thanks