How is value for "Original Temperature" determined?

@ajax Let us keep it simple and examine the output of dcraw, which is what I would call the grandfather of raw processors.

>dcraw -v sample.nef
Loading Nikon D3300 image from sample.nef ...
Scaling with darkness 150, saturation 4095, and
multipliers 2.393118 1.000000 1.223981 1.000000
AHD interpolation...
Converting to sRGB colorspace...

dcraw gathers information from its own database to determine the scaling levels; i.e. where the noise floor and saturation points are. Then it proceeds to read the multipliers from the metadata of the raw file, which were determined by your cameraā€™s white balance settings (mostly based on defaults of and assumptions about the camera). As you can see, temperature is not a part of the equation; what the raw processor reads from the file is not the temperature.

Temperature, tint and kelvin are abstractions of these multipliers, based on what is assumed to be true of each colour array and individual pixels. You would need a colorimeter or spectrophotometer at the scene to tell you what the colour or wavelength of the light sources were exactly. Or at least have a grey or colour reference handy.

That said, colour replication would be impossible if you donā€™t have a good colour management habits, so consider colour profiling your camera, screen, printer, paper, etc., and consider the ambient temperature of the room where you are editing and where and how the images will be displayed and viewed. Before you know it, you turn into a colour expert. :rofl:

There is a gold mine of info on the web. Here are some links to get you started.

1 Like

@ajax - I agree with @afre and @ggbutcher - simpler is better. When white-balancing a raw file, as @afre noted temp/tint is an abstraction from the actual white balance multipliers. Agreeing with @ggbutcher, for just plain white balancing a raw file Iā€™d just as soon not even see the temp/tint sliders. Even the various raw processors all have different temp/tints for nominally ā€œthe sameā€ white balance (for example ā€œdaylightā€), but the actual white-balanced image produced by each raw processor is very similar.

If the image isnā€™t a raw file, then find a nominally gray spot in the image and in GIMP use Levels to white balance, just make sure you set Levels to work on linear RGB and that the image is at floating point precision. Youā€™ll probably need to move the lower Value slider to restore proper exposure - itā€™s easier to do this sort of white balancing in RawTherapee, darktable, etc than in GIMP.

On the other hand and depending on your goals, RawTherapeeā€™s CIECAM02 module is considerably more than just an abstraction from raw multipliers. But again, thereā€™s a learning curve, thatā€™s well worth climbing depending on the goal, for example preserving or restoring the ā€œcolor of the lightā€ instead of white-balancing it away. But this would be digital image processing 201 or higher :slight_smile: maybe not so useful for most editing tasks.

1 Like

Color temperature is a property of the light that illuminated the subject (I looked that up). Once the image is captured by a particular sensor, the lightā€™s color temperature is expressed as the ratios of the red, green and blue channels in the depiction of the color white (this is my conclusion, anyone feel free to correct me). So, the problem becomes aligning the individual channels so they make white do this: R=G=B.

In the olden days (my grandkids have told me anything earlier than 2008 are the olden days), color film emulsions were crafted to respond to the color temperature of light to make white R=G=B. Digital cameras have both that and the green bias of the CFA to worry, and the multipliers in the metadata correct for both.

So, bear-of-little-brain here thinks that messing with white balance using the channel multipliers directly makes more intuitive sense than using a color temperature slider to produce the multipliers. A color temperature slider on the camera, used to change the sensor response based on the actual light on the scene at the time of capture, would make more sense to me but itā€™s probably simpler to just hard-code the camera to one response and fiddle with the multipliers after the fact.

As always, FWIWā€¦

Back to the original question, ā€œHow is the value for Original Temperature calculated?ā€

Iā€™m not aware of a way to calculate it if youā€™re working with a non-raw file.

A test.

Here is a raw photo in RawTherapee, the white balance temperature is too high at 7600K, making the whole image too orange:

I saved the too-warm image as a 16-bit PNG file for later use:

I use the white balance picker to make the paper in the background neutral, which sets the temperature to 4500K:

Now open the too-warm PNG file in GIMP. Ideally GIMP would also have a pipette allowing you to pick a spot on the image which should be neutral, to calculate the optimal temp and tint for you, but GIMP 2.10.4 doesnā€™t have that yet, so you have to adjust the temperature manually.

GIMP does not know the original color temperature (how could it), so it sets both original and intended temperatures to a reasonable 6500K:

We know from RawTherapee that the correct temperature to balance the whites is 4500K. If you adjust the intended temperature in GIMP to 4500K, you get this:


The image still has an orange/yellow tint, because the source temperature is incorrect.

If you adjust the intended temperature visually to taste, you may arrive at 4000K which gives you this:


That is the best I could do, acting like I donā€™t know the source temperature. Note that the paper is close to neutral, but the rest of the photo still has a tint (the red flower is a dirty orange-red), and it does not match the correct 4500K image from RawTherapee.

If I set the intended temperature any less than 4000K it would make things even worse - the red flower is now less orange, closer to red but still ā€œdirtyā€, and the paper has now turned bluish:

We cannot properly correct the white balance through setting the intended temperature without knowing the original temperature.

I was under the impression that if I set the original temperature to 7600K, which we know to be correct as that is what I set when I saved the image in RawTherapee, then setting the intended temperature to 4500K would result in an image identical to the 4500K one from RawTherapee, but it did not (compare this to the second RawTherapee screenshot):

3 Likes

More puzzles, this time in RawTherapee.

When you open the PNG in RawTherapee, it shows the temperature as 6490K and tint as 1.002 - why the 10K and 0.002 differences?

When I set the imageā€™s original temperature to 6490K in GIMP and set the desired temperature to 4000K, the result is nothing like if I open the PNG in RawTherapee where the temperature defaults to 6490K and then set the temperature to 4000K:

1 Like

Should I convert to Fahrenheit? :stuck_out_tongue_closed_eyes:

Donā€™t think so.
6490K equals 11222.33 deg F.
Centigrade (Celsius) sounds a trifle better, since 6490K equals 6216.85 deg C,
at least thatā€™s what Dr. Google has to say.

Have fun!
Claes in Lund, Sweden

I did similar experiments and didnā€™t come with a satisfactory answer. That is why I answered the way I did. Hope @ajax got what he wanted. :slight_smile:

@Claes I use Celsius.

I was loosely referring to
http://edition.cnn.com/TECH/space/9909/30/mars.metric.02/

Yes, and also the cameraā€™s particular spectral response, Iā€™d surmise.

Post-processing tools like Color Temperature and Exposure are actually ā€œcompensationsā€, attempting to deal post-priori with phenomenon relevant to the moment of image capture. And I think, as @Morgan_Hardwoodā€™s experiment suggests to me, using a post-processing Color Temperature tool that doesnā€™t start with good information on the original light and sensor characteristics is really just an arbitrary color manipulation tool.

Edit: Okay, maybe a little heavy-handed coming from a neophyte like me, but I am interested in what more knowledgeable folk think about it. Itā€™s all about learningā€¦

Yes, IIRC the temperature and tint depend on the camera input profile.

Well now, when I posted my question I was thinking the answer might be simple. Little did I know that such an extensive lesson in photo editing would unfold. While Iā€™m most grateful for the lesson and still have a good bit of reading left to do in order to complete it one take-away of mine is that Morgan got to the simple answer when he said, ā€œIā€™m not aware of a way to calculate it if youā€™re working with a non-raw file.ā€. When composing my question I was hoping that ā€œdeterminedā€ might be even simpler than ā€œcalculatedā€ but calculate would do. Unfortunately it looks like it is lost. Although, another take-away is that this doesnā€™t seem to bother you more experienced photographers and I need to be trying to join you.

Morganā€™s test was very thorough and certainly beats anything Iā€™d done in the way of an actual experiment. However, his mind seemed to be exactly where mine was when thinking there could (maybe should) be a more positive answer that fit with the new GIMP CT Tool. In that, there is a known value for CT when the raw file is developed and, like I suspected, this is what GIMP was meaning by ā€œOriginal Temperatureā€. I was also thinking that maybe it would be worthwhile for me to keep track of that value (degrees kelvin) for the raw files that I develop. However, I think Morganā€™s test also demonstrates that a CT value is not sufficiently precise to be transferable from one editing program to another. While it still seems like preserving this ā€œAs Developedā€ CT value could be of some use, at least as much as a lot of other metadata that is being kept, there are limits to how useful it might be.

Many thanks to all for your willingness to engage. I hope my question did not create too big a distraction from other things you might rather have done. I now have some more topics on my study list which need attention.

Your question was timely in my case; Iā€™m writing a white balance tool for my software and was wrestling with what was pertinent and what was not.

What Iā€™m gearing up to do is to write a ā€œmechanicā€™s tutorialā€ on raw processing, starting with the really raw data array and stepping through the operations needed to get a basic usable image. The similar Gā€™MIC tutorial that uses dcraw and the gmic command line tool were invaluable to me in learning this, my thought is to step through screen shots of my hack software that will provide both a sequential depiction of tools and the respective histograms. Some of what will be illustrated is very material to the question weā€™ve just discussed here, and may provide perspective for your other questions.

1 Like

!

That is exactly what Iā€™ve been gearing up to do over the last few weeks - a workflow from the moment the photon hits the sensor till you have a ready image. I read something along those lines some years ago, IIRC it was about demosaicing etc a raw file using ImageJ - have you seen that article? I specifically want to focus on the color aspect of it, as that part is still a mystery to me, I only know parts, and it would be nice to lay out what happens to color during the whole process.

Would you be interested in collaborating on this, perhaps writing it in this wiki-forum?

3 Likes

Sounds like something Iā€™d be very interested in reading/studying. How are we students to find it when itā€™s ready?

Iā€™d love for this to be an article on the main pixls.us!

I made a critical mistake last night, ubuntu prompted ā€œupgrade to 18.04?ā€ and I said yesā€¦

Once I get that all sorted out, Iā€™ll proceedā€¦

Did Ubuntu social engineer the consent? :rofl: I click on YES out of habit to my detriment.

@Morgan_Hardwood, I would definitely be interested. Iā€™ll send a PM so we donā€™t clutter the thread.

I have it all sorted out, but not before I inadvertently wiped my home directory :frowning: Lesson learned: donā€™t multitask during OS upgrades. That, and Wayland way-laid meā€¦

Not a great loss, most of my important files are on my Windows tablet. Will have to re-calibrate my display, lost that profile, but actually starting to build rawproc from scratch turned out to be beneficial in that I found almost all of the prerequisite libraries in their current versions in the distro. I only had to compile wxWidgets 3.1.1.

Oh, back to color temperatureā€¦ sorry.