During the last few months I tried to figure out a way to match images using the MacBeth ColorChecker directly in Nuke. A similar functionality has been provided by HDRShop already but it’s always more convenient (and, of course, cheaper) to be able to stay within the same application. After a little research on the math, I’ve come up with a solution with this little gizmo called mmColorTarget.
It has inputs for a source and target image and a multi sampler for each one of them. The sampler can easily be corner pinned to a still image of a MacBeth chart and it will sample all of the 24 patches at the same time. In the “Patches” tab you can also disable certain patches in case they are occulded in the image or if you just want to exclude them to tweak the calculation. Collapse the source or target knob groups depending on what view you are currently in, otherwise you could accidentally move the wrong corner pins.
If you just want to “neutralize” the colors of the source image, you can check the “Use Reference Values as Target” checkbox. This will ignore the target input and use the neutral sRGB Values used by the MacBeth chart as target values.
As soon as everything is set up, hit the “Calculate Matrix” button and the gizmo will create a new ColorMatrix Node that approximates the source to the target values. You can also easily compare the effect of the gizmo by switching the current View to “compare”. This will show the source values looking through the target patches.
Here’s a quick demonstration (Watch on Vimeo):
Heavily color corrected material has probably gone through a lot of selective (and therefore non-linear) color changes, which makes it hard to match through a linear transformation. That’s why the gizmo works best on raw/unprocessed out-of-cam material.
Since it’s just an approximation, it does not work 100% and it fails occasionally, especially if the footage is way too messed up or ill exposed (so no reason to start being too lazy while shooting your images). In the most cases it does a pretty good job though.
I hope it’ll be useful to anyone.
UPDATE: New Version 2.0 available
- More intutive UI with callbacks
- Fixed a problem introduced in Nuke 9.0v8 that broke the entire functionality
- The reference target now comes with a dynamic colorspace selection instead of fixed sRGB Values. (generously provided by Thomas Mansencal at colour-science.org)
- Additional sampling method “no clip” (as suggested in the comments by Oleg Alexander, EXPERIMENTAL!)
- More stability due to no more expression-based-sampling in the background
The gizmo now ships with an external JSON file, that contains the additional colorspaces. I kept them in an external file, so the gizmo is easier to update in case any new colorspaces of interest show up in the future.
So if that happens, colour-science.org is the place to go and find the tools to get them. Here’s a direct link where you will most likely find the most recently updated file. Also here’s an IPython Notebook with a snippet to generate the data yourself.
You can place the file relative to any directory that is added to your nuke plugin path to get auto-detected by the Gizmo (easiest would be to just place it next to the .gizmo file), or just use an absolute path if you have a special pipeline setup going on (Environment Variables will also be resolved).
If no file is detected, the Gizmo will fallback to sRGB as the only colorspace that’s still internally included.
With this new feature you can also generate presets from sampled values and put them in a custom json file, if you have some frequently used target values to match your plates or HDRs to. Just stick to the layout of the included colorspace file to make sure it can be read properly. By the way, the sampled values are printed to Nuke’s output window every time you calculate a matrix, and can be copied from there. Be aware, that only sampled values from all 24-patches using “direct” sampling are eligible to create presets.
- Sometimes the resulting ColorMatrix will still have all-zero values. If that happens, just delete the faulty ColorMatrix and try it again. If a second attempt still doesn’t work, try switching the current view knob in the gizmo back and forth. It just seems to be an update problem inside Nuke, so it should work eventually.
Unfortunately the gizmo does not work out of the box, there’s some additional setup required.
You will need to have the Python module “NumPy” installed and compatible with the Nuke version you are using, which is either NumPy for Python2.6 (Nuke7) or NumPy for Python2.7 (Nuke8).
To make it even more difficult, Nuke compatible modules should be compiled against a certain compiler version in order to work, which is VS2010 for Nuke7/8 Windows, GCC 4.1 on Linux and GCC 4.0 on Mac.
Quick test: Type
import numpy in the nuke script editor, if it doesn’t return any errors you’re good to go.
- Windows: The available binaries for NumPy are mostly not compiled against VS2010. However I have found a version on CGTalk that works with Nuke8 (credit goes to skuzee, thanks for compiling & sharing): Download here. If you are using Nuke7, you can use the numpy version thats included with every Houdini 13 Installation.
- Linux: Check your repositories, NumPy should be available at least for your distros native version of Python.
- Mac: I don’t have a Mac, so please add a comment here or on nukepedia if you can tell me about the availability of compatible NumPy versions.
Tested successfully on Windows 7 and 10 (Nuke7/8/9) and CentOS 6 and 7 (Nuke7/8/9/10.x/11.x)
If you like this tool and it helps you in production, please consider a donation via PayPal.me. Thanks!
❌ I had to disable comments for now. Please send me an email if there are any questions