I have a list of about 500 images similar to the following:
A = Import["http://i.stack.imgur.com/1bV4O.png"]
AbsoluteTiming[Colorize[A, ColorFunction -> "AvocadoColors"]]
takes ~ 0.6 seconds, which scales to around 5 minutes for applying the Colorize
function to my list of 500 images.
In other programs, this general feature of mapping grayscale values to colors is quite fast. I'd like to find a way to speed this up if possible. Thanks!
Answer
It is also pretty straightforward to create your own color map. For example, the following code reads in the image, and multiplies each of the color channels by an appropriate factor, then recombines the three into a single color image. It is very fast. Change the constants (in this case, 0, 1, and 0) at will.
img = Import["http://i.stack.imgur.com/1bV4O.png"];
rimg = ImageMultiply[img, 0];
gimg = ImageMultiply[img, 1];
bimg = ImageMultiply[img, 0];
ColorCombine[{rimg, gimg, bimg}]
Comments
Post a Comment