How to manipulate/change hue, saturation, and value of an image all together?
74 ビュー (過去 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 で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!