How to manipulate/change hue, saturation, and value of an image all together?
85 次查看(过去 30 天)
显示 更早的评论
I want to know how to manipulate the hue, saturation, and value of an image. I know that you can manipulate and RGB image to change the colors from red to yellow by using different numbers and I wanted to know if the same conceptr applies to HSV. I would greatly appreciate examples of this!
Particlulary I want to change the hue, saturation, and value by the value of .25 just to see how an image can change and then convert this back to an RGB image which I know is done through hsv2rgb, but I just don't know how to change the hsv part.
0 个评论
采纳的回答
Image Analyst
2022-7-9
Try something like this:
% Convert to HSV
hsvImage = rgb2hsv(rgbImage);
% Get individual channels
[h, s, v] = imsplit(hsvImage);
% Add 0.25 to s image
s = s + 0.25;
% Add 0.25 to h image
h = h + 0.25;
% Make back into 3-D image
hsvImage = cat(3, h, s, v);
% Convert back into RGB
rgbImage = hsv2rgb(hsvImage);
You might have to convert rgbimage back into uint8 if the values are floating point values in the range 0-255.
2 个评论
更多回答(2 个)
DGM
2022-7-9
编辑:DGM
2022-7-9
If you like reinventing the wheel every single time and only want to use HSV, feel free. There are advantages in terms of flexibility, but you'll have to at least make sure to preserve the continuity of H. If you want to use another color model, things get more complicated.
Barring direct conversion and manipulation methods, there aren't really concise color adjustment tools in base MATLAB/IPT. There are purpose-built third-party tools.
MIMT imtweak can do most simple tasks in one line, and the image class is preserved. Imtweak() supports operations in several color models other than HSV, which may be beneficial if you are concerned about preserving brightness/contrast while adjusting hue and saturation. In that regard, HSV is probably the worst thing to use.
This is one example. I've used it in many other examples here as well, so a forum search should turn up others that may be tangentially related.
0 个评论
Image Analyst
2022-7-9
编辑:Image Analyst
2022-7-9
Alexander, to learn more about image processing with MATLAB:
Try my File Exchange:
Also see the examples in the web site for the IMage Processing Toolbox.
Also see Steve's blog:
and File Exchange:
Steve is the leader of the Image Processing Team. He also has a textbook about it.
Also see
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!