Hello, Herz -
I'm sorry that I didn't see this thread when you first posted it. Color accuracy is a topic that I am particularly interested in.
Steve's suggestion about shooting in RAW with a full
Macbeth / Xrite Color Checker standard in each frame is spot on if you had not already taken the photographs. BTW, if you shoot in RAW and have such a standard in each frame, it is unnecessary to perform a custom white balance at the time you take each photo. Doing so afterwards, back in the lab, using your raw converter software (eg, ACR, Raw Therapee, Capture One, Nikon Capture NX, etc.) is entirely equivalent (if not better) than doing it in the camera with a custom white balance.
Another very useful technique you could have employed would have been to use a professional flash (in manual mode) on your camera. This provides a strong light source of known, constant color and intensity which could have been easily set up to overpower any variations in ambient daylight.
FWIW, it turns out that one of the teams I am currently directing is trying to automate the classification of skin lesions based on photographs. To ensure color, brightness and contrast consistency from day to day and across many different types of skin, my team is employing three of the above suggestions: a flash, saving the data in RAW format, and then performing final small color and tonal adjustments in ACR.
However, as we say in the States, at this point, suggesting any of these things to you is a bit like suggesting to the farmer that he should close the door after the cows have already run out of the barn, LOL, so we have to deal with what we have: a bunch of JPGs.
You do have a few color patches in each frame, but unfortunately, the patches do not include any colors (eg, brown or tan) that are close to the colors of your core samples. As you will see, this is a very serious shortcoming.
If you had thousands of these to process, I would suggest that you find someone who knows Matlab and have them write a program for you using this toolbox:
http://www.vision.caltech.edu/bouguetj/calib_doc/ .
FYI, there is also a nice list of other image processing tools here:
http://www.mathtools.net/MATLAB/Image_Processing/index.html
However, since you only have around 100 images to process, and because you are missing brown/tan reference patches, I don't think the results using any post-processing method are going to be good enough for scientific purposes. So, my suggestion is that you first try a manual approach on some fraction of the 100 to see if it produces sufficiently accurate results.
I would suggest the following steps:
1. Take each of your photos into ACR and use the "color eyedropper" tool to try to make the G18 patch a neutral gray. This will be possible for some, but not all of your images. Even for the latter, just getting it closer to a neutral gray is better than doing nothing. Next, using the exposure slider in ACR, make the RGB readings of this patch in all of your images as close to a constant value (say, 180, 180, 180) as possible. Save the output of ACR for each image as a PSD file. Select one of these to be your "master". In other words, you will be trying to make the known colors in each of the other images match this one.
2. Display an image to be calibrated on the same layer (in PS) as the reference image.
3. My manual approach relies on a little-known, but very powerful color correction plugin called "
Color Mechanic". Invoke the "Color Mechanic" plugin. One uses it by drawing arrows from a "starting" color to a "desired" color. Do this for each of the pairs of color patches in the two images being displayed. You should wind up with a transformation diagram that looks something like this:
The result of this color transformation is shown below.
Note that the colors of each of the transformed color patches now almost perfectly matches the corresponding patch in the reference image, whereas the corresponding patch colors were far off before this step.
*HOWEVER*, because there were no browns or tans among the reference color patches, these, most important colors weren't well corrected -- in fact, because of this, they got much worse, not better! ! !
There is a way to partially work around this problem. If the color of the cardboard box in all your images is the same, one can try to use it as an ad-hoc color reference in this part of the spectrum. Unfortunately, some portions of the cardboard are in shadow, some are more directly illuminated, some areas have dust, other areas do not, some areas are illuminated by light reflected off of the samples, other areas are not.
So, to try to come up with some compromise, I selected three or four areas of the cardboard and performed an exactly analogous transformation on them as I did previously with the color patches. Also, so that the colors of the previously corrected color reference patches did not change when applying the new transformation, I locked these down with points without arrows emanating from them. The result is shown below.
As you can see, the above procedure did, as you requested, make the color patches, and even the color of the cardboard match fairly well, but:
a) it looks like because of the lack of sufficient spread in the reference color patches, the procedure messed up the slightly off-gray cores;
b) a lot of experience using Color Mechanic is required;
c) the process is time intensive;
d) ad-hoc, non-quantitative color change decisions must be made; and,
e) unfortunately, I am fairly certain that this procedure somewhat compressed the browns and tans into a smaller range than they really have.
Nevertheless, it's up to you whether a procedure like this might be of sufficient accuracy for scientific / engineering purposes.
To be honest, if it was me, and there was the possibility of re-photographing the samples, I would do so (using the method described early in this post). It would undoubtedly be more accurate, and probably would take less time than trying to fix the problem in software, after the fact.
I hope this little demo was of some use to you.
Cheers,
Tom