Simple question: Is there any built in function for images that acts similar to imagesc in matlab, i.e. take grayscale image scale it to use full [0,1] range and then use some kind of colorgradient to plot the image?

The one thing I use right now is to first use HistogramTransform to scale to full [0,1] range then obtain image data via ImageData and then use ArrayPlot with appropriate ColorFuntion:

ArrayPlot[image // HistogramTransform // ImageData, ColorFunction -> "TemperatureMap"]

Of course this works just fine, but I am curious if I overlooked some procedure operating directly on images.

  • 2
    $\begingroup$ Colorize does what you need? $\endgroup$ – Kuba Aug 15 '13 at 12:50
  • 2
    $\begingroup$ imagesc is like ImageAdjust $\endgroup$ – bill s Aug 15 '13 at 13:29
  • $\begingroup$ Ok, thanks guys. For some reason I did not see that Colorize works directly with Images, too. So a combination of Colorize and ImageAdjust should do the job. $\endgroup$ – Wizard Aug 15 '13 at 14:05

As suggested in the comments ImageAdjust and Colorize is one way to go

img = ImageMultiply[ExampleData[{"TestImage", "Aerial"}], .1]
Colorize[ImageAdjust[img], ColorFunction -> "SunsetColors"]

Another way is to use the ImageApply and transform the colors with ColorData. On this occasion let me point out, that Blend can be used too (it's 4 characters shorter :-)

ImageApply[List @@ Blend["SunsetColors", #] &, ImageAdjust[img]]

Mathematica graphics


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.