multicolorfits.colorize_image#

multicolorfits.colorize_image(image, colorvals, colorintype='hex', dtype=<class 'numpy.float64'>, gammacorr_color=1)[source]#

Add color of the given hue to an RGB greyscale image.

Parameters:
  • image (array) – Greyscale RGB image – as would be output from to_grey_rgb()

  • colorvals (str or list or tuple) – color values to apply to image. e.g., ‘#FF0000’ if colorintype=’hex’

  • colorintype (str) – ‘hsv’ for [0..1,0..1,0..1], ‘rgb’ for [0..255,0..255,0..255], or ‘hex’ for ‘#XXXXXX’

  • dtype (dtype) – Defaults to standard numpy float, but may want to lower to e.g. float32 for large images (>~1000x1000)

  • gammacorr_color (float) – To use color as-is, leave as 1 (default). To gamma-correct color at this step (e.g., to match gamma for checking a scaled image), specify a factor

Returns:

array – Colorized RGB image, shape=[ypixels,xpixels,3]