uniwb multipliers question

Hi.
After setting up my camera to uniwb, dcraw shows the following multipliers.
I was expecting the green multiplier to be 1.000, but it isn’t. After the readings I made to implement uniwb, I assumed that the green channel is always to be invariant, but maybe this is a wrong assumption.

gustavo@N4050:~/Pictures/2020/20200214_cr2_uniwb$ dcraw -w -v IMG_6915.cr2 
Loading Canon EOS 5D image from IMG_6915.cr2 ...
Scaling with darkness 128, saturation 3692, and
multipliers 1.291240 1.164960 1.000000 1.164960
AHD interpolation...
Converting to sRGB colorspace...
Writing data to IMG_6915.ppm ...

Regardless, developing a few images has presented no problem so far, so maybe this is a nonsense question.

See -H [0-9] Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild)

I still don’t understand:

gustavo@N4050:~/Pictures/2020/20200214_cr2_uniwb$ dcraw -w -v -H 0 IMG_6915.cr2
Loading Canon EOS 5D image from IMG_6915.cr2 ...
Scaling with darkness 128, saturation 3692, and
multipliers 1.291240 1.164960 1.000000 1.164960
AHD interpolation...
Converting to sRGB colorspace...
Writing data to IMG_6915.ppm ...
gustavo@N4050:~/Pictures/2020/20200214_cr2_uniwb$ dcraw -w -v -H 1 IMG_6915.cr2
Loading Canon EOS 5D image from IMG_6915.cr2 ...
Scaling with darkness 128, saturation 3692, and
multipliers 1.000000 0.902203 0.774449 0.902203
AHD interpolation...
Converting to sRGB colorspace...
Writing data to IMG_6915.ppm ...
gustavo@N4050:~/Pictures/2020/20200214_cr2_uniwb$ dcraw -w -v -H 2 IMG_6915.cr2
Loading Canon EOS 5D image from IMG_6915.cr2 ...
Scaling with darkness 128, saturation 3692, and
multipliers 1.000000 0.902203 0.774449 0.902203
AHD interpolation...
Blending highlights...
Converting to sRGB colorspace...
Writing data to IMG_6915.ppm ...
gustavo@N4050:~/Pictures/2020/20200214_cr2_uniwb$ dcraw -w -v -H 3 IMG_6915.cr2
Loading Canon EOS 5D image from IMG_6915.cr2 ...
Scaling with darkness 128, saturation 3692, and
multipliers 1.000000 0.902203 0.774449 0.902203
AHD interpolation...
Rebuilding highlights...
Converting to sRGB colorspace...
Writing data to IMG_6915.ppm ...

dcraw’s “-H” modes don’t change the ratio between the multipliers. The modes do change the normalisation of the multipliers. “-H 0” normalises so the smallest multiplier is 1.0 (it divides all multipliers by the smallest). The other modes normalise to the largest multiplier is 1.0 (it divides all multipliers by the largest).

Can you explain how you did this?

I thought the purpose of uniwb was to set all multipliers to 1.0 in the camera. But I could be wrong.

I I followed the steps in

https://blog.kasson.com/using-in-caera-histograms-for-ettr/8-a-one-step-uniwb-procedure/

Good evening, Rei!

I may be slow tonight, but why do you want to incorporate uniwb into your flow?

Have fun!
Claes in Lund, Sweden

Godnatt, Claes.

For the same motivation that drove the first “uniwb developers” to devise it, as stated by one of the first users here.
EDIT: Also, a recommended reading:

dcraw reports numbers after doing some calculation. What multipliers are reported by exiftool?

Since multipliers show in many exif entries, I prefer to list the entire exif set of info (sorry about that).

ExifTool Version Number         : 10.80
File Name                       : IMG_6915.cr2
Directory                       : .
File Size                       : 11 MB
File Modification Date/Time     : 2020:02:14 06:08:52-03:00
File Access Date/Time           : 2020:02:16 08:15:52-03:00
File Inode Change Date/Time     : 2020:02:14 06:54:47-03:00
File Permissions                : rw-rw-r--
File Type                       : CR2
File Type Extension             : cr2
MIME Type                       : image/x-canon-cr2
Exif Byte Order                 : Little-endian (Intel, II)
Image Width                     : 2496
Image Height                    : 1664
Bits Per Sample                 : 8 8 8
Compression                     : JPEG (old-style)
Make                            : Canon
Camera Model Name               : Canon EOS 5D
Preview Image Start             : 88196
Orientation                     : Horizontal (normal)
Preview Image Length            : 1222466
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Modify Date                     : 2020:02:14 06:08:50
Exposure Time                   : 1/40
F Number                        : 11.0
Exposure Program                : Manual
ISO                             : 100
Exif Version                    : 0221
Date/Time Original              : 2020:02:14 06:08:50
Create Date                     : 2020:02:14 06:08:50
Components Configuration        : Y, Cb, Cr, -
Shutter Speed Value             : 1/41
Aperture Value                  : 11.3
Flash                           : Off, Did not fire
Focal Length                    : 35.0 mm
Macro Mode                      : Normal
Self Timer                      : Off
Quality                         : RAW
Canon Flash Mode                : Off
Continuous Drive                : Continuous
Focus Mode                      : One-shot AF
Record Mode                     : CR2+JPEG
Canon Image Size                : Large
Easy Mode                       : Manual
Digital Zoom                    : None
Contrast                        : -4
Saturation                      : -4
Metering Mode                   : Evaluative
Focus Range                     : Not Known
Canon Exposure Mode             : Manual
Lens Type                       : Canon EF 35-80mm f/4-5.6 or Tamron Lens
Max Focal Length                : 80 mm
Min Focal Length                : 35 mm
Focal Units                     : 1/mm
Max Aperture                    : 4
Min Aperture                    : 23
Flash Activity                  : 0
Flash Bits                      : (none)
Zoom Source Width               : 0
Zoom Target Width               : 0
Manual Flash Output             : n/a
Color Tone                      : -4
Focal Type                      : Zoom
Focal Plane X Size              : 37.62 mm
Focal Plane Y Size              : 24.84 mm
Auto ISO                        : 100
Base ISO                        : 100
Measured EV                     : 12.75
Target Aperture                 : 11
Target Exposure Time            : 1/40
Exposure Compensation           : 0
White Balance                   : Custom
Slow Shutter                    : None
Shot Number In Continuous Burst : 0
Optical Zoom Code               : n/a
Camera Temperature              : 25 C
Flash Guide Number              : 0
Flash Exposure Compensation     : 0
Auto Exposure Bracketing        : Off
AEB Bracket Value               : 0
Control Mode                    : Camera Local Control
Measured EV 2                   : 12.375
Bulb Duration                   : 0
Camera Type                     : EOS High-end
ND Filter                       : n/a
Canon Image Type                : Canon EOS 5D
Canon Firmware Version          : Firmware Version 1.1.1
Owner Name                      : Moreno Rocha
Serial Number                   : 2421203367
Camera Orientation              : Horizontal (normal)
AF Points In Focus 5D           : (none)
Firmware Revision               : 1.1.1.2
Short Owner Name                : Moreno Rocha
Directory Index                 : 100
File Index                      : 6915
Contrast Standard               : 0
Contrast Portrait               : 0
Contrast Landscape              : 0
Contrast Neutral                : 0
Contrast Faithful               : 0
Contrast Monochrome             : 0
Contrast User Def 1             : -4
Contrast User Def 2             : 0
Contrast User Def 3             : 0
Sharpness Standard              : 3
Sharpness Portrait              : 2
Sharpness Landscape             : 4
Sharpness Neutral               : 0
Sharpness Faithful              : 0
Sharpness Monochrome            : 3
Sharpness User Def 1            : 0
Sharpness User Def 2            : 3
Sharpness User Def 3            : 3
Saturation Standard             : 0
Saturation Portrait             : 0
Saturation Landscape            : 0
Saturation Neutral              : 0
Saturation Faithful             : 0
Filter Effect Monochrome        : None
Saturation User Def 1           : -4
Saturation User Def 2           : 0
Saturation User Def 3           : 0
Color Tone Standard             : 0
Color Tone Portrait             : 0
Color Tone Landscape            : 0
Color Tone Neutral              : 0
Color Tone Faithful             : 0
Toning Effect Monochrome        : None
Color Tone User Def 1           : -4
Color Tone User Def 2           : 0
Color Tone User Def 3           : 0
User Def 1 Picture Style        : Standard
User Def 2 Picture Style        : Standard
User Def 3 Picture Style        : Standard
Time Stamp                      : 2020:02:14 06:08:50
Focusing Screen                 : Ee-A
Set Function When Shooting      : Default (no function)
Long Exposure Noise Reduction   : Auto
Flash Sync Speed Av             : Auto
Shutter-AE Lock                 : AE lock/AF
AF Assist Beam                  : Emits
Exposure Level Increments       : 1/3 Stop
Flash Firing                    : Fires
ISO Expansion                   : Off
AEB Sequence/Auto Cancel        : 0,-,+/Enabled
Superimposed Display            : On
Menu Button Display Position    : Previous (top if power off)
Mirror Lockup                   : Disable
AF Point Selection Method       : Normal
E-TTL II                        : Evaluative
Shutter Curtain Sync            : 1st-curtain sync
Safety Shift In Av Or Tv        : Disable
AF Point Activation Area        : Standard
LCD Display Return To Shoot     : With Shutter Button only
Lens AF Stop Button             : AF stop
Add Original Decision Data      : Off
Canon Model ID                  : EOS 5D
Num AF Points                   : 15
Valid AF Points                 : 15
Canon Image Width               : 4368
Canon Image Height              : 2912
AF Image Width                  : 4992
AF Image Height                 : 3328
AF Area Width                   : 119
AF Area Height                  : 119
AF Area X Positions             : -1043 -499 0 499 1043 499 0 -499 0 -199 0 199 199 0 -199
AF Area Y Positions             : 0 249 445 249 0 -249 -445 -249 0 249 249 249 -249 -249 -249
AF Points In Focus              : (none)
Thumbnail Image Valid Area      : 0 159 7 112
Serial Number Format            : Format 2
Original Decision Data Offset   : 0
Bracket Mode                    : Off
Bracket Value                   : 0
Bracket Shot Number             : 0
Raw Jpg Size                    : Large
Long Exposure Noise Reduction 2 : Auto
WB Bracket Mode                 : Off
WB Bracket Value AB             : 0
WB Bracket Value GM             : 0
Lens Model                      : EF35-80mm f/4-5.6
Internal Serial Number          : E737587
Tone Curve                      : Standard
Sharpness                       : 0
Sharpness Frequency             : n/a
Sensor Red Level                : 0
Sensor Blue Level               : 0
White Balance Red               : 0
White Balance Blue              : 0
Color Temperature               : 5200
Picture Style                   : User Def. 1
Digital Gain                    : 0
WB Shift AB                     : 0
WB Shift GM                     : 0
Measured RGGB                   : 403 1024 1024 637
Sensor Width                    : 4476
Sensor Height                   : 2954
Sensor Left Border              : 100
Sensor Top Border               : 39
Sensor Right Border             : 4467
Sensor Bottom Border            : 2950
Black Mask Left Border          : 0
Black Mask Top Border           : 0
Black Mask Right Border         : 0
Black Mask Bottom Border        : 0
VRD Offset                      : 0
Color Data Version              : 1 (1DmkIIN/5D/30D/400D)
WB RGGB Levels As Shot          : 1135 1024 1024 879
Color Temp As Shot              : 5502
WB RGGB Levels Auto             : 2416 1024 1024 1382
Color Temp Auto                 : 6599
WB RGGB Levels Measured         : 2414 1024 1023 1380
Color Temp Measured             : 6599
WB RGGB Levels Daylight         : 2032 1024 1024 1540
Color Temp Daylight             : 5200
WB RGGB Levels Shade            : 2330 1024 1024 1277
Color Temp Shade                : 7000
WB RGGB Levels Cloudy           : 2185 1024 1024 1396
Color Temp Cloudy               : 6000
WB RGGB Levels Tungsten         : 1528 1107 1107 2641
Color Temp Tungsten             : 3200
WB RGGB Levels Fluorescent      : 1786 1024 1024 2208
Color Temp Fluorescent          : 3794
WB RGGB Levels Kelvin           : 2032 1024 1024 1540
Color Temp Kelvin               : 5200
WB RGGB Levels Flash            : 2245 1024 1024 1334
Color Temp Flash                : 6483
WB RGGB Levels PC1              : 2032 1024 1024 1540
Color Temp PC1                  : 5200
WB RGGB Levels PC2              : 2032 1024 1024 1540
Color Temp PC2                  : 5200
WB RGGB Levels PC3              : 2032 1024 1024 1540
Color Temp PC3                  : 5200
WB RGGB Levels Custom           : 1135 1024 1024 879
Color Temp Custom               : 5502
Per Channel Black Level         : 128 128 128 128
Flash Output                    : 0%
Flash Battery Level             : n/a
Measured RGGB Data              : 6184 15598 14938 9164
Picture Style User Def          : Standard; Standard; Standard
Picture Style PC                : Standard; Standard; Standard
User Comment                    : 
Flashpix Version                : 0100
Color Space                     : sRGB
Exif Image Width                : 4368
Exif Image Height               : 2912
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Focal Plane X Resolution        : 3086.925795
Focal Plane Y Resolution        : 3091.295117
Focal Plane Resolution Unit     : inches
Custom Rendered                 : Normal
Exposure Mode                   : Manual
Scene Capture Type              : Standard
Thumbnail Offset                : 76348
Thumbnail Length                : 11848
Photometric Interpretation      : RGB
Samples Per Pixel               : 3
Rows Per Strip                  : 256
Planar Configuration            : Chunky
Strip Offsets                   : 1605574
Strip Byte Counts               : 10062724
CR2 CFA Pattern                 : [Red,Green][Green,Blue]
Raw Image Segmentation          : 1 2238 2238
Aperture                        : 11.0
Drive Mode                      : Continuous Shooting
File Number                     : 100-6915
Image Size                      : 4368x2912
Lens                            : 35.0 - 80.0 mm
Lens ID                         : Canon EF 35-80mm f/4-5.6
Megapixels                      : 12.7
Preview Image                   : (Binary data 1222466 bytes, use -b option to extract)
Scale Factor To 35 mm Equivalent: 1.0
Shooting Mode                   : Manual
Shutter Speed                   : 1/40
Thumbnail Image                 : (Binary data 11848 bytes, use -b option to extract)
WB RGGB Levels                  : 1135 1024 1024 879
Blue Balance                    : 0.858398
Circle Of Confusion             : 0.030 mm
Field Of View                   : 54.3 deg
Focal Length                    : 35.0 mm (35 mm equivalent: 35.1 mm)
Hyperfocal Distance             : 3.71 m
Lens                            : 35.0 - 80.0 mm (35 mm equivalent: 35.1 - 80.2 mm)
Light Value                     : 12.2
Red Balance                     : 1.108398

Let’s think through the problem. I think the purpose of (the rather awkward) UniWB is to make the JPEG driven histogram in the camera behave as if it were a raw one. This ruins the JPEG and so there is no point using the JPEG+RAW mode as you have.

To approach this problem, I would first need to take a photograph of a evenly soft illuminated grey card near saturation. If I know the properties of the card and lighting, I would know what WB, etc., settings to change to make the histogram behave in the way I want it to.

Now here are the multipliers that (I believe) you should be examining. I say “(I believe)” because I haven’t done this in a long time and every camera has different metadata. If I recall correctly, you could ask exiftool or maybe it was exiv2 to expose the full name of the tags to make sure you have the right one(s).

Measured RGGB                   : 403 1024 1024 637
Measured RGGB Data              : 6184 15598 14938 9164

If these are the correct ones, then you can clearly see that the ratio is off from R=G=B. Clearly something is wrong. If I recall correctly, Mr Kasson’s quick method depends on your monitor being calibrated / profiled in a particular way.

I noticed something else in your metadata.

Picture Style                   : User Def. 1
Picture Style User Def          : Standard; Standard; Standard

In my opinion, it shouldn’t be Standard but Neutral. If you don’t have Neutral, then Faithful. Basically, turn down or off anything that would affect the JPEG and make it more abstract from what the “raw” output would be (e.g., sharpening, non-linear modes).

PS I noticed that your dcraw output says 3692 as saturation. At 12 bit, it should be 4096 as the max value. I wonder why dcraw would use the former value…

I’m not familiar with Canon exiftool results, but I think the “Measured RGGB” mentioned by @afre is what the camera measures from the scene. But the camera is set to use a custom WB, isn’t it, so it ignores the measured RGGB?

I think these are the important ones:

WB RGGB Levels As Shot          : 1135 1024 1024 879
WB RGGB Levels Custom           : 1135 1024 1024 879

These are exactly the ratios given by @gadolf above, but in RGBG order:

dcraw … multipliers 1.291240 1.164960 1.000000 1.164960
I think the goal of uniwb is to get all four multipliers the same, or at least very close. Perhaps the camera has the ability to dial down the red channel slightly, and dial up the blue channel slightly. Take another photo, and what does “WB RGGB Levels As Shot” say?

Ideally, cameras would have a simple ability to set the four multipliers. Alas, that would be too simple.

I used measured because (I believe) that is what the camera actually sees. If you think of it another way, in measured, the reds are lacking; so in the WB settings, we give red more weight. In any case, @gadolf should be able to verify the appropriate tags.

I couldn’t find anything on the internet that makes sense to me regarding those tags.

I think that’s the point, at least from what Guillermo Lujik says:

image

(http://www.guillermoluijk.com/tutorial/uniwb/index_en.htm)

I was going to link to his page. :slight_smile: Also on his tutorial, I see

image

What’s this? :stuck_out_tongue: ↑ Take a look at the metadata to glean on what Mr West did.

Yes, I saw that.
But I wanted to start from scratch. Anyway, since my camera is rather old (5D from 2005), I thought it would be better to do it manually so that I ended up having measurements according to this specific camera, not a generic 5D image probably produced by a healthier 5D camera than mine.

What I mean is that you do your part and then compare his metadata with yours. I had trouble downloading it via Firefox so I used a separate downloader. Here is the file for reference: uniwb5d.cr2 (11.5 MB).

Now, examining the metadata

WB RGGB Levels As Shot          : 2439 1024 1024 1260
WB RGGB Levels Custom           : 2433 1024 1024 1907
WB RGGB Levels Measured         : 1029 1026 1021 1009
Measured RGGB                   : 1008 1024 1024 1129
Measured RGGB Data              : 174777 173054 173707 176590

I see.
I was already doing that, but since you’ve made it, thanks.
In summary, his uniwb5d.cr2 shows:

  1. dcraw

    gustavo@N4050:~/Pictures$ dcraw -w -v uniwb5d.cr2
    Loading Canon EOS 5D image from uniwb5d.cr2 …
    Scaling with darkness 127, saturation 3692, and
    multipliers 2.381836 1.000000 1.230469 1.000000
    AHD interpolation…
    Converting to sRGB colorspace…
    Writing data to uniwb5d.ppm …

  2. (the data you’ve already analyzed):

    WB RGGB Levels As Shot : 2439 1024 1024 1260
    WB RGGB Levels Custom : 2433 1024 1024 1907
    WB RGGB Levels Measured : 1029 1026 1021 1009
    Measured RGGB : 1008 1024 1024 1129
    Measured RGGB Data : 174777 173054 173707 176590

My uniwb5d_gadolf shows:

  1. dcraw

    gustavo@N4050:~/Pictures/2020/20200213_cr2_uniwb$ dcraw -w -v IMG_6909.cr2
    Loading Canon EOS 5D image from IMG_6909.cr2 …
    Scaling with darkness 128, saturation 3692, and
    multipliers 1.972656 1.000000 1.448242 1.000000
    AHD interpolation…
    Converting to sRGB colorspace…
    Writing data to IMG_6909.ppm …

  2. exiftool
    gustavo@N4050:~/Pictures/2020/20200213_cr2_uniwb$ exiftool IMG_6909.cr2 | grep RGGB
    Measured RGGB : 847 1024 1024 1304
    WB RGGB Levels As Shot : 2020 1024 1024 1483
    WB RGGB Levels Auto : 2020 1024 1024 1483
    WB RGGB Levels Measured : 1129 1024 1023 898
    WB RGGB Levels Daylight : 2032 1024 1024 1540
    WB RGGB Levels Shade : 2330 1024 1024 1277
    WB RGGB Levels Cloudy : 2185 1024 1024 1396
    WB RGGB Levels Tungsten : 1528 1107 1107 2641
    WB RGGB Levels Fluorescent : 1786 1024 1024 2208
    WB RGGB Levels Kelvin : 2032 1024 1024 1540
    WB RGGB Levels Flash : 2245 1024 1024 1334
    WB RGGB Levels PC1 : 2032 1024 1024 1540
    WB RGGB Levels PC2 : 2032 1024 1024 1540
    WB RGGB Levels PC3 : 2032 1024 1024 1540
    WB RGGB Levels Custom : 2222 1024 1024 1029
    Measured RGGB Data : 89009 98381 98909 114937
    WB RGGB Levels : 2020 1024 1024 1483

EDIT: Take note that what I call “my uniwb5d_gadolf” is the image I took from the screen after following all the steps to produce the image that will bring jpeg wb closer to raw, which, in my case, is IMG_6909.cr2

I am confused by the image above of Mr Lujik’s. His maximum deviation looks like he is doing R-G=5.6%. If we do that with the provided CR2 or yours, we get a huge difference. Something is amiss.

Yeah, mine is 1.291240 - 1.164960 = 0.12628, or 12.6%, which is more than double the recommended channel deviation of around 5%.
Well, although I still don’t understand why in first place dcraw doesn’t show 1.000 for G for an image taken with uniwb, from the tests I made so far I have a somewhat approximate “raw histogram” in my camera.