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.
0 个评论
回答(2 个)
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
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Orange 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!