mmColorTarget – Nuke Gizmo

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

Changes:
– 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

Instructions Colorspaces:
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.

Known Issues:
– 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.

Installation:
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.

12 Responses to mmColorTarget – Nuke Gizmo

thoma2014/10/04

Could you give a non-programmer explanation of how to install numpy to the system (win7)? I tried using the setup.py files in a command prompt and no luck. Which is the compiled file? compiled_base.pyd?

marco2014/10/04

I assume that you just want to use numpy with nuke to run the gizmo. In that case the easiest way is to copy the numpy folder to your “C:UsersYOURNAME.nuke” directory.
And that should be it.

I just found your mmColorTarget gizmo and I think it’s great! I also wrote a similar tool (although mine runs outside of Nuke, so not as cool as yours :) One thing I wanted to mention is that you should discard clipped values in both source and target before computing the matrix. So if any pixel in any channel in either source or target is above 0.98, set this pixel to 0 in both source and target. Doing this drastically improves the calibration :)

Great work!

marco2015/04/14

Hey Oleg.
Thanks for your feedback! Greatly appreciated! That’s a good point that never came across me, I will try to implement that in my next release. Might be tricky though since currently I’m sampling an area in source and target image, that is not necessarily of the same position, orientation and pixel density, so I guess I will have to find a way to even out the sampled area somehow. Please correct me if I’m wrong, always good to have some smart people around :) Cheers!

Ted2015/12/19

Hi Marco, this seems like a fantastic gizmo. However when I hit “calculate matrix” I get the error ‘NoneType object has no attribrute __getItem__”. I’m using Nuke 9.0.8 on Windows 10. I have Python 2.7 and the numpy you linked to above installed. What’s strange is that I can see the colored circles, move them into place, etc. Furthermore if I try to use the reference values as a target the resulting color matrix is all zeroes. Do you have any advice?

Thank you!

marco2016/01/03

Hey Ted.
Thanks for letting me know about this issue. I had a look and it seems like the Foundry did changes to the sample expression in the latest Nuke 9.0v8 patch release (BUG ID 5177). I assume this is now causing an expression error inside the Gizmo that simply hasn’t been present before.

I’m releasing a new version of the gizmo soon, which will have that problem fixed, along with some other bugfixes and new features. In the meantime, you can try using an older Nuke9.0 release than v8 when creating the matrices, and copy them over if necessary. I’ve tested v5 successfully but since that bugfix I mentioned came with v8, I assume v7 will do fine as well.

Ted2016/01/05

Great! Thanks very much Marco. I’m also looking forward to your new version!

Brianofnazareth2016/04/08

As an fyi I was able to install numpy 1.7.1 with python 2.7 on OSX 10.10.4 from the following sources;

Hi, could you please explain where I should put the mmColorTarget folder?

Javier B2017/10/10

Amazing work! it would be gret that it can also work with differents targets.. or that besides turning on/off colors.. we can use another targets like xrite passport video. Thanks very much for your hard work my friend!

michael_k2018/03/22

Hi. Lovely tool. Thank you for writing it! I’m running 11.1v2 on Win7. The gizmo is running fine when i first bring it it but when I save and reopen there’s a slew of “no such knob” errors and in the properties window looks like a blank node. Wondering if anyone has any ideas as to what may be the problem. It’s a very useful little tool. Would love to be able to get this working fully.
thanks,
Michael