How to apply a filter to an image to scale the saturation?
4 views (last 30 days)
Show older comments
I am trying to represent two distinct variables in a single figure by denoting one of the variables with hue and the other with saturation.
See below for an example from the literature:
The color bar contains two variables: phase and intensity. Color hue represents phase while color saturation represents the intensity. (Note: the authors should have written "intensity" instead of "amplitude")
To achieve this figure, I have one matrix that represents intensity
and another that represents phase
I would like to scale the saturation of each point in the phase matrix by the corresponding value of the intensity matrix. For example, there are regions in the intensity matrix where there is 0 signal. The saturation of the corresponding indices in the phase matrix ought to be multiplied by 0 in this case. On the other hand, there are other regions in the intensity matrix where the signal is brightest, i.e. 1. The saturation of the corresponding indices in the phase matrix ought to be unchanged in this case. To summarize the question, I would like to use a matrix of values between 0 and 1 as a filter to scale the saturation of a different matrix with the same dimensions. In this case, the matrix of values between 0 and 1 is the intensity matrix and the matrix-to-be-scaled is the phase matrix.
0 Comments
Answers (2)
Image Analyst
on 11 May 2018
Use hsv2rgb where you construct the hsv image with your matrices:
hsvImage = cat(3, hueImage, saturationImage, intensityImage);
rgbImage = hsv2rgb(hsvImage);
See how that works. If it doesn't look good, try making the intensity image range from 0-100
intensityImage = 100 * mat2gray(intensityImage);
before putting into hsvImage. If RGB image is in the range 0-255 then it must be cast to uint8 before displaying. If it's in the range 0-1 then you should be able to use imshow on it directly.
3 Comments
Image Analyst
on 12 May 2018
I'm a little unsure what you want. If the intensity is low, it will be black. If you don't want it black then set intensity equal to one minus intensity. If you can, mock up what you'd like and show that, and attach your images for phase, hue, saturation, and intensity.
See Also
Categories
Find more on Orange in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!