This approach maps the colour distribution of an over/under stained image to that of a well stained target image. Reinhard presented a method for matching the colour distribution of an image to that of a target image by use of a linear transform in a perceptual colourspace (the lαβ colourspace of Ruderman et al. ) so as to match the means and standard deviations of each colour channel in the two images in that colourspace.
 Derek Magee, Darren Treanor, Doreen Crellin, Mike Shires, Katherine Smith, Kevin Mohee, and Philip Quirke.:Colour normalization in digital histopathology images.
 Reinhard, E., Adhikhmin, M., Gooch, B., Shirley, P.: Color transfer between images.
This implementation is probably WRONG. I think The lab space used in that paper is different from the CIELAB.
See this paper: http://www.cs.virginia.edu/~jdl/bib/color/ruderman98.pdf
Can you improve your code?
You can use this image.
It is H-DAB stainned
Can you suggest some images for target?
I mean, I know it's application dependent, but say, for a particular stain (Giemsa, HE, etc.) it would be really awesome if you can provide a few sample images.
Keep up the good work :)