|
Posted at 10/27/2017 06:21:16
Only Author
6#
Last edited by Pup-Xav In 10/27/2017 15:09 Editor
I was able to get a "raw" (YUV422) picture with android 5.1 running on a rk3288.
The Camera.takePicture() method takes a callback for raw as second parameter.
- camera.takePicture ( shutterCallback, rawCallback, jpegCallback );
Copy the code This callback will return a null byteArray, unless you explicitly add a buffer for raw image .
- addRawImageCallbackBuffer.invoke(camera, bytes);
Copy the code Surprisingly, the method is public but not exported, so you cannot call it directly.
The pseudo-code below demonstrate how to call it by reflection.
- ...
- byte[] bytes = new byte[100000000]);
- android.hardware.Camera camera = Camera.Open();
- ...
- try {
- final Method addRawImageCallbackBuffer =
- camera.getClass()
- .getDeclaredMethod("addRawImageCallbackBuffer",
- byte[].class);
- addRawImageCallbackBuffer.invoke(camera0, bytes);
- } catch (Exception e) {
- Log.e("RNG", "Error", e);
- }
- ...
- camera.takePicture ( shutterCallback, rawCallback, jpegCallback );
- ...
Copy the code For reference : https://stackoverflow.com/questi ... and-raw-takepicture
|
|