Posted by
Gabriel Landini on
Mar 18, 2009; 8:59pm
URL: http://imagej.273.s1.nabble.com/patterns-and-coloring-for-b-w-2D-picture-tp3693253p3693255.html
On Wednesday 18 March 2009 17:18:18 Ludwig Schreier wrote:
> Then I was searching the web for a particular plugin or feature to
> colourize a 2D black/white pictures and in particular to give
> different colouring to different patterns of that picture, but since
> there are so many plugins I could not find one yet which does the job.
There are no plugins for colorizing semi automatically that I know of,
although I collected a number of references in the hope that somebody will
take the challenge:
http://imagejdocu.tudor.lu/doku.php?id=wishlist:procedure:colorizing_algorithm> If not, do you know any other plugin(s) that do such things like
> colouring of b/w pictures, identifying patterns, etc.?
Colorizing and identifying patterns are very different things...
Some time ago I needed to colour an old old print, and the following macro was
useful, but nowhere near what the references above can do.
The idea is to add a hue and saturation to a greyscale image to a user defined
ROI, while keeping the brightness constant.
One problem, however is that going from RGB to HSB to RGB many times tends to
quantise the image do to rounding errors in each conversion.
Cheers
Gabriel
//----------8<---------------
// Colourize_.txt
// G. Landini at bham. ac. uk
// Macro to facilitate colourizing greyscale images
run("RGB Color");
hue=64;
sat=127;
while(true) {
waitForUser("Colourize", "Make a selction to paint");
Dialog.create("Colourize");
Dialog.addNumber("Hue", hue) ;
Dialog.addNumber("Saturation", sat) ;
setForegroundColor(255, 255, 255); // so when exiting it is white
Dialog.show() ;
hue=Dialog.getNumber();
sat=Dialog.getNumber();
run("HSB Stack");
setSlice(1);
setForegroundColor(hue, hue, hue);
run("Fill", "slice");
setSlice(2);
setForegroundColor(sat, sat, sat);
run("Fill", "slice");
run("RGB Color");
}
//----------8<---------------