Colour calibration with nip2
The colour calibrator built into nip is not sophisticated, but it is easy to use and adequate for simple stuff. It fits a curve to the Macbeth greyscale to remove camera gamma, then does a least-mean-square to find the 3x3 matrix which goes from linear camera RGB to CIE XYZ. It will work with 8- and 16-bit source images.
You can customise it for any colour chart, but out of the box it expects a Macbeth Colour Checker. You can buy these charts in most photographic supply shops for 40 pounds.
Here's a test picture with one of these charts in shot:
I took this photo with a Canon IXUS 400 in daylight mode, ISO 50, high quality JPEG. The room is top-lit with diffuse daylight. Here's a link to the original photo if you're interested.
The first thing to do is to rotate the image to get the chart square. On the image view window, hold down the Ctrl button and drag up and right along the bottom edge of the Macbeth chart. This will mark an Arrow, the thing nip uses to indicate directions.
Once you've marked the arrow, you can drag on the label to position it, or drag on either of the crosses at the ends to alter the endpoints. Position the arrow along the bottom edge of the Macbeth.
Now back in the main window click on Toolkits / Image / Transform / Rotate / Straighten. This button looks at an arrow and performs the smallest rotation which will make the line marked by the arrow either horizontal or vertical. Your main window should look like this:
Now crop the chart area out of the rotated image. Double-click on the rotated thumbnail to open a viewer, zoom and pan to get the chart visible, then hold down Ctrl and drag down and right to mark the chart area. You don't need to be very exact.
Back in the main window, you can now (finally) click Toolkits / Tasks / Capture / Find Color Calibration. There will be a short pause while nip does some analysis, then the calibrated chart should appear:
The calibration object (A5 in this example) has a number of pieces inside it. From the top, these are the percentage of each Macbeth chart square that nip2 should average to measure the camera response, the input chart with squares drawn on it to show the measured area, the file from which nip2 got the true Macbeth patch colours (double-click on this to chose a different file, perhaps one with measures of your personal chart in), a menu to let you select the linearization method (see below), the linearising function that nip2 is using, the 3x3 matrix that goes from normalised linear camera RGB to CIE XYZ, normalization factor, the residual error (7 dE in this case), and the worst colour (almost always cyan for RGB cameras).
nip2 has several methods for linearizing the camera image. The one in the shot above fits a curve to the greyscale patches on the Macbeth chart. This works, but can be misleading and won't give great results for things much darker or lighter than the Macbeth. If your camera attaches an ICC profile, you can get better results by using Colour / ICC / Import to make an XYZ image, then selecting Linear Input in this menu.
You can use this calibration object (A5) to fix the colour in other images. Of course, they need to have been taken with the same lighting, and with the same camera settings. Click on A5 to select it, then Ctrl-click on A1 (the original image we loaded from the file) to select that as well, then click Toolkits / Tasks / Capture / Apply Color Calibration. A new image will pop up, with fixed colour:
Finally, here are the before and after pictures side by side.
It's an interesting comparison. Canon have set their camera to produce extremely bright, saturated colours on the factory setting. The rather muted colour from the corrected image looks a little dull at first, but on the plus side, the corrected image should be much easier to compare to pictures from other cameras.