Processing RAW/DNG images from mobile phones

The metadata for ColorMatrix1 tag is present.

I took some sample RAW pictures yesterday and below is a copy of all the tags from one of the DNG photos. I should explain realme is a new mobile/cell phone brand recently launched in Europe by OPPO. The mobile model is realme 3 Pro but it may also be known as RMX1851 which comes up in the EXIF data. It has 1 front and two rear facing cameras and one of the rear is described as a Sony in the marketing. The samples I took are of course only rear.

======== IMG_OCT_20191005_150058.dng
ExifTool Version Number : 10.80
File Name : IMG_OCT_20191005_150058.dng
Directory : .
File Size : 31 MB
File Modification Date/Time : 2019:10:05 15:00:58+01:00
File Access Date/Time : 2019:10:05 18:03:40+01:00
File Inode Change Date/Time : 2019:10:05 18:01:15+01:00
File Permissions : rwxr-----
File Type : DNG
File Type Extension : dng
MIME Type : image/x-adobe-dng
Exif Byte Order : Little-endian (Intel, II)
Subfile Type : Full-resolution Image
Image Width : 4656
Image Height : 3496
Bits Per Sample : 16
Compression : Uncompressed
Photometric Interpretation : Color Filter Array
Image Description :
Make : Realme
Camera Model Name : RMX1851
Strip Offsets : (Binary data 30280 bytes, use -b option to extract)
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 1
Strip Byte Counts : (Binary data 17479 bytes, use -b option to extract)
X Resolution : 72
Y Resolution : 72
Planar Configuration : Chunky
Resolution Unit : inches
Software : Realme/RMX1851EEA/RMX1851L1:9/PKQ1.190101.001/1566479375:user/release-keys
Modify Date : 2019:10:05 15:00:58
CFA Repeat Pattern Dim : 2 2
CFA Pattern 2 : 2 1 1 0
Copyright :
Exposure Time : 1/649
F Number : 1.8
GPS Version ID : 2.3.0.0
GPS Latitude Ref : North
GPS Longitude Ref : West
GPS Time Stamp : 14:00:56
GPS Date Stamp : 2019:10:05
ISO : 100
Date/Time Original : 2019:10:05 15:00:58
Focal Length : 4.3 mm
TIFF-EP Standard ID : 1 0 0 0
DNG Version : 1.4.0.0
DNG Backward Version : 1.1.0.0
Unique Camera Model : RMX1851-Realme-Realme
CFA Plane Color : Red,Green,Blue
CFA Layout : Rectangular
Black Level Repeat Dim : 2 2
Black Level : 63 64 64 63
White Level : 1023
Default Scale : 1 1
Default Crop Origin : 8 8
Default Crop Size : 4640 3480
Color Matrix 1 : 0.3515625 -0.09375 -0.0625 -0.328125 1.3125 0 -0.140625 0.4765625 0.5546875
Color Matrix 2 : 0.890625 -0.2265625 -0.1640625 -0.328125 1.3125 0 -0.1015625 0.328125 0.3828125
Camera Calibration 1 : 1 0 0 0 1 0 0 0 1
Camera Calibration 2 : 1 0 0 0 1 0 0 0 1
As Shot Neutral : 0.4912109375 1 0.5546875
Baseline Exposure : 0
Calibration Illuminant 1 : D55
Calibration Illuminant 2 : Standard Light A
Active Area : 0 0 3496 4656
Forward Matrix 1 : 0.5625 0.140625 0.265625 0.1484375 0.7890625 0.0625 0.015625 -0.4765625 1.28125
Forward Matrix 2 : 0.5625 0.140625 0.265625 0.1484375 0.7890625 0.0625 0.015625 -0.4765625 1.28125
Opcode List 2 : (Binary data 3908 bytes, use -b option to extract)
Opcode List 3 : (Binary data 4 bytes, use -b option to extract)
Noise Profile : 0.000113406166 9.5309258140625e-07 0.000113406166 9.5309258140625e-07 0.000113406166 9.5309258140625e-07
Aperture : 1.8
CFA Pattern : [Blue,Green][Green,Red]
GPS Date/Time : 2019:10:05 14:00:56Z
GPS Latitude : 53 deg 14’ 37.89" N
GPS Longitude : 2 deg 13’ 42.38" W
GPS Position : 53 deg 14’ 37.89" N, 2 deg 13’ 42.38" W
Image Size : 4656x3496
Megapixels : 16.3
Shutter Speed : 1/649
Focal Length : 4.3 mm
Light Value : 11.0

Herewith a sample DNG. The EXIF data are above.

IMG_OCT_20191005_150058.dng (31.1 MB)

My phone’s pictures with Raw Therapee have this problem (my is Honor 6a, i have uploaded the raw to raw.pixls.us a lot of time ago): Exif support for HUAWEI Honor View 20 PCT-L29 · Issue #5414 · Beep6581/RawTherapee · GitHub

Your phone’s the same.

Second problem i have made a vignetting profile for lensfun a lot of time ago, but it isn’t yet commited ( Added Honor 6a vignetting by falket · Pull Request #876 · lensfun/lensfun · GitHub ) . And vignetting is heavy on my phone.

Third problem, even if i change the relevant xml local file, Raw Therapee has troubles with so big vignetting correction, that leads to clipped highlights. Lensfun vignetting correction and clipped highlight · Issue #4169 · Beep6581/RawTherapee · GitHub

Seems like vignetting could be fixed with dng opcodes but atm no oss software seems to support them.

4th colors are not that great but i don’t have an it8.

Anyway i have made some good pictures with my phone. And i have tried with your picture and the camera seems even better! Shot in raw soon or later i think they will be even better supported.

Opens just fine here in RT. I know darktable has opened DNGs from cameras without explicit support before (Xiaomi Mi Sphere), although I haven’t used it in quite a while. I’m guessing there’s something about that particular DNG it doesn’t like but I don’t know what.

1 Like

You should add your lensfun profile to your lensfun installation and then you can use it. It doesn’t have to be accepted by lensfun (but that would be nice).

1 Like

Based on what I could glean from Anders’ dcamprof missive, I think this is the matrix that should be amended to camconst.json… @Morgan_Hardwood?

1 Like

As previously indicated, I can open this file in Darktable but cannot get it to look very nice. The JPG you developed in RawTherapee looks good. I have RT too and I was aware that it can open my DNGs.

I have started to get vaguely comfortable with Darktable with my main camera. I tried RT a while ago and it looked good. But learning Darktable was already stretching my grey cells to the limit so decided not to try to learn RT too.

I’ve just loaded the image in RT and it does look better and have been able to get somewhere near the vibrancy you achieved in the JPG above.

But for some reason on my PC, the picture is very grainy in RT when I zoom in. It remains high definition in both Darktable and qeeqie. I’m not sure if that is my RT installation on Ubuntu, or maybe its normal and the resulting JPG from RT would not be so grainy.

I will look to upload this RAW sample image as suggested by @stefan.chirila

Thanks again.

It would be great if you provided some screenshots of RT and dt (with version info) to show us what you mean. darktable (the d is lowercase :wink:) has good out of the box profiled denoising but it could be another issue…

Thanks @afre this is the screenshot of a zoomed in section via RTScreenshot%20from%202019-10-06%2019-47-02

It seems clearer in darktable

Screenshot%20from%202019-10-06%2019-47-46

The zoom level seems to be different. Could you also provide the pp3 and xmp?

Correction geeqie does not display the realme’s dngs only the S6’s. I got confused just now because I had restored the camera’s own jpg and geeqie had paired them. Apologies.

@afre the zoom I used is approximately the same but the graininess is massively better with darktable.

These are un-cropped. I created my screen shots by simply zooming in.

IMG_OCT_20191005_150058.dng.pp3 (10.1 KB) IMG_OCT_20191005_150058.dng.xmp (3.8 KB)

Hey @ggbutcher , it should be the ColorMatrix which corresponds to the D65 illuminant.

This camera uses ColorMatrix2 for StdA while RawTherapee expects ColorMatrix2 to be for daylight - see Derive correct ColorMatrix by checking CalibrationIlluminant · Issue #5126 · Beep6581/RawTherapee · GitHub

I observed no difference in the way RawTherapee renders the image nor in the way it calculates the temperature and tint when creating a camconst.json entry for this camera:

    {
        "make_model": [ "Realme RMX1851" ],
        "dcraw_matrix": [ 3516, -938, -625, -3281, 13125, 0, -1406, 4766, 5547 ] // ColorMatrix1 D55 from camera software: Realme/RMX1851EEA/RMX1851L1:9/PKQ1.190101.001/1566479375:user/release-keys
    },

@HimAgain don’t expect the image on your laptop screen to look like the image on your smartphone, i.e. don’t think that just because the image on the laptop looks different or worse than the image on the smartphone then your raw processing software is to blame. The screens on the two devices are most likely vastly different.

1 Like

@HimAgain It is important that the zoom is at 100% when you take the screenshots. When the zoom is less or greater than 100%, the quality goes down because the app has to interpolate pixels values. I will let someone else check your work and provide their pp3 and xmp for comparison.

Thank you, i know, but i don’t understand why i have at least 3 good profiles waiting for inclusion since months…

Lensfun, like many projects, is short on man power.

Ah, as opposed to the “media white point” for the Forward Matrix? I don’t see such in @HimAgain’s metadata, so I’m not sure how the ForwardMatrix can be used for his image…

Learn new things every day…

Is it not true that the shelf life of a smartphone is not more than couple of years? This is especially true when it comes to budget phones. On the other hand a digital camera is meant to be used for more than 10 years. So why would the lensfun team, already hard pressed for time, spend time on including profiles which will be used for such a short period?

1 Like