Composition of different wavelength (channel) images

7 views (last 30 days)
I would like to create a color image from a set of intensity images (grayscale) each one corresponding to different wavelengths (colors). In order to do that, for each image:
  • I set the wavelength to the hue (H) value (from red=0 to blue=2/3) thanks to a simple linear transformation
  • I set saturation (S) to 1 (fully saturated colors)
  • I normalize the intensity and set it to the value (V)
Although this part seems to work properly, when I try to combine the corresponding set of HSV images, I am getting strangely colored results.
So far, the most coherent results have been achieved for imfuse with the alpha blending option after transforming the HSV images to RGB but I would expect different outcome. (see http://stackoverflow.com/questions/25587530/fusing-more-than-2-images-in-matlab)
Can you suggest some other way of forming a single colored image from the different channels (>3)?
  1 Comment
DGM
DGM on 20 Jun 2022
Edited: DGM on 20 Jun 2022
The accepted answer in that StackOverflow thread is nonsense. It will result in both improper layer weighting and improper joint data scaling. None of the answers address the joint data scaling correctly either.
Imfuse() has no utility for combining more than two images. It cannot be used iteratively to produce anything other than an improperly-weighted/scaled/colored/padded composition.
If you have N solid images and you do an equal-weighted alpha blending of them, the result is the simple arithmetic mean of the images. You can calculate the arithmetic mean in any way you want (see beaker's answer in that thread for one way). The joint scaling option offered by imfuse() is another story. Whether or not it's relevant depends on the type of images you're trying to combine. If it is relevant, then it requires knowledge of the extreme values of all the images. The images can individually be scaled to a common range after those extrema are gathered, but gathering them requires that any incremental loop-based approach must read the images twice.
This answer covers basic methods for color images, and there is an example that replicates joint data scaling behavior for grayscale images.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!