How to apply a filter to an image to scale the saturation?

4 次查看(过去 30 天)
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.

回答(2 个)

Image Analyst
Image Analyst 2018-5-11
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 个评论
Image Analyst
Image Analyst 2018-5-12
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.
Jordan Epstein
Jordan Epstein 2018-5-16
Instead of replying to your comment, I accidentally added a new answer. Please see below for a response to your comment.

请先登录,再进行评论。


Jordan Epstein
Jordan Epstein 2018-5-14
I want the processed phase image to be white in regions where the intensity is low. And in regions where the intensity is high, the processed phase image should retain the color of the original phase image.
For example, look below for black arrows that indicate the brightest regions of the intensity image.
I want the processed phase image to be effectively unchanged in this area of the spectrum. In contrast, the blue arrows indicate the regions of the spectrum with very low intensity. Here I want the processed phase image to be white.
I made a poor quality mock-up using Illustrator. See below.
The phase, hue, saturation, and intensity images are attached as a mat file.

类别

Help CenterFile Exchange 中查找有关 Orange 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by