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 file which nip got the true Macbeth patch colours from (double-click on this to chose a different file, perhaps one with measures of your personal chart in), the gamma table that
nip calculated from your chart (fun to look at, not very useful), the 3x3 matrix that goes from normalised linear camera RGB to CIE XYZ, the residual error (7 dE in this case), and the worst colour (almost always cyan for RGB cameras).
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:
This image is in CIELAB format with every pixel represented by three floating point numbers, not very useful for interchange with other applications. As a final step, click on Toolkits / Colour / Convert to / sRGB. This will convert to the standard sRGB format. You can now save the corrected image as a JPEG somewhere.
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.