I have integrated affectiva library and trying to fetch emotions using camera stream. I tried to fetch the bitmap from the frame returned but it always returns null.Below is the code.
byte[] imageBytes = ((Frame.ByteArrayFrame) frame).getByteArray();
We have some 518 kb of data but when converted to image it returns null.
Bitmap bitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
previewImage.setImageBitmap(bitmap);
I even tried the below code but again null bitmap
Bitmap bmp=frame.getOriginalBitmapFrame();
Could you please help me to fetch bitmap from the frame?
There are some sample conversion methods in Affectiva's
affdexme-android
sample app:https://github.com/Affectiva/affdexme-android/blob/a0c732fb0378b9c0883d30fa21eaa9cf22b57eed/app/src/main/java/com/affectiva/affdexme/ImageHelper.java#L221