How to manipulate/change hue, saturation, and value of an image all together?
조회 수: 91 (최근 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!