0

I have a rooted Galaxy A3 2017 (SM-A320F) running Android 8.0.0. I'm trying to capture raw photos, but neither the stock Camera app nor Open Camera show any relevant options (I have enabled Camera2 API). This option wasn't present before rooting too. On another phone, unrooted Galaxy Note8, the option is present at least in Open Camera.

So I suppose the option is somehow disabled in my A3. Can it be re-enabled without switching to a completely different firmware? How?

Note that another question proposed as a duplicate is 1) asking about very old version of Android — 4.2.2, which doesn't have Camera2 API, and 2) asks simply whether there exist any apps with such functionality, which today is of course yes. So this one is not a duplicate. This question is about how to re-enable the missing raw photo support instead.

2
1

Camera2 API alone doesn't necessarily mean you can shoot RAW, though you can run the free app Manual Camera Compatibility. If it shows that your phone supports RAW, you should be able to shoot RAW with the Manual Camera app itself.

Photoshop Lightroom is another app capable of capturing and editing RAW, so maybe that's worth a shot aswell.

8
  • Lightroom also doesn't work, which is unsurprising, given that the capability is not exposed via the API. And Manual Camera simply lies, saying that the device supports raw shooting (see also its reviews). Of course, I'm not going to buy it simply to find out that it doesn't work.
    – Ruslan
    Aug 14 '18 at 5:35
  • Fair enough, I didn't know the Manual Camera test lied, I had phones showing incompatibility on it earlier. What is the output of this app? That developer doesn't have any camera app to sell so maybe that app is more truthful. Aug 14 '18 at 9:21
  • Oh, nevermind me, I just saw your edit. So you're already aware that your device's HAL3 doesn't do RAW at all which is nothing you can do about sadly. This would be up to the phone manufacturer to do. Aug 14 '18 at 9:27
  • The Camera2 probe app does confirm that raw capture is not available. This one looks much more reliable. The question of how to re-enable raw support remains...
    – Ruslan
    Aug 14 '18 at 10:17
  • You can't just re-enable RAW support yourself or by flashing a custom firmware or ROM. Try contacting the manufacturer for a solution as only they are able to provide you with that functionality. This comes down to hardware level drivers, Camera2 API is only an interface to use available functions like RAW. Even while your camera sensor (Sony IMX 258) might be perfectly capable, if the manufacturer decided not to include RAW support, sadly, you're out of luck here. Aug 14 '18 at 10:32
0

It appears to already be possible, with the stock firmware! I was about to try tracing an NDK-powered camera app (thanks to Sisik's tutorial with a demo) with strace to see which API calls lead to which ioctls to aid further searches, when, while trimming down the demo, I noticed that the native camera API exposes AIMAGE_FORMAT_RAW16 with dimensions 4144×3106 on my Galaxy SM-A320F/DS. After I went ahead and tried capturing an image in this format, I indeed got a true 16-bit Bayer output, which after simplistic demosaicing and white-balancing resulted in a pretty decent raw image.

There's a small strangeness though: the bottom part of the image (pixels 2333 through 3106) is always filled with zeros. I'm not sure why this is so, but at least the upper 75% of the data are present and usable.

How to get RAW support in OpenCamera

Currently, OpenCamera detects whether a camera supports RAW by REQUEST_AVAILABLE_CAPABILITIES_RAW. If there's no such capability, the detection simply gives negative result. For SM-A320F this is incorrect, because it doesn't report this capability, but RAW16 format is among the supported output formats.

To work around this misdetection, we can apply the following patch to OpenCamera 1.47.3, and build our own APK. This patch will stub out the check for the capability, making OpenCamera search for the format desired regardless.

diff --git a/app/src/main/java/net/sourceforge/opencamera/cameracontroller/CameraController2.java b/app/src/main/java/net/sourceforge/opencamera/cameracontroller/CameraController2.java
index 2c6463c..939b00b 100644
--- a/app/src/main/java/net/sourceforge/opencamera/cameracontroller/CameraController2.java
+++ b/app/src/main/java/net/sourceforge/opencamera/cameracontroller/CameraController2.java
@@ -2062,7 +2062,7 @@ public class CameraController2 extends CameraController {
         //camera_features.picture_sizes.get(0).supports_burst = false;

         raw_size = null;
-        if( capabilities_raw ) {
+        if( true || capabilities_raw ) {
             android.util.Size [] raw_camera_picture_sizes = configs.getOutputSizes(ImageFormat.RAW_SENSOR);
             if( raw_camera_picture_sizes == null ) {
                 if( MyDebug.LOG )

I've reported this at OpenCamera's issue tracker as ticket 661.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.