By umresh
on Thu, 09/04/2014 - 12:29
Hi,
Code provided in FAQ "How to access camera image?" throws exception in the line "byte[] pixelArray = pixels.array();" and the exception is
java.lang.UnsupportedOperationException:at java.nio.DirectByteBuffer.protectedArray(DirectByteBuffer.java:92)at java.nio.ByteBuffer.array(ByteBuffer.java:129) Please its urgent I need help. Thanks.
Error in reading pixel array
same error for me. I am using this code:
Error in reading pixel array
See updated code snippet in the FAQ:
https://developer.vuforia.com/forum/faq/android-how-can-i-access-camera-image
in particular, use these lines instead:
Error in reading pixel array
When I convert that byte[] to a bitmap using BitmapFactory.decodebytearray it throws exception.
Error in reading pixel array
You should not use the BitmapFactory.decodebytearray() method, as the camera image is not a PNG or JPEG image.
The correct solution is posted here:
https://developer.vuforia.com/forum/android/camera-image-returns-black
Please follow up in that thread.