how to convert HSV to RGB

조회 수: 3 (최근 30일)
sanjay
sanjay 2014년 3월 21일
답변: Image Analyst 2014년 3월 21일
i extracted h = hsv(:,:,1), s = hsv0(:,:,2), and v= hsv(:,:,3) from(hsv = rgb2hsv();) now i modify h and then i have to convert it back to RGB image.
I mean input of hsv2rgb function are what type?

답변 (2개)

Patrik Ek
Patrik Ek 2014년 3월 21일
편집: Patrik Ek 2014년 3월 21일
The input for rgb2hsv is a rgb color vector [r g b] where intensities is between 0 and 1 the the other way it is vice versa. The type is a single or a double matrix.
a = [1 0 0]; % red
b = rgb2hsv(a); % [0 1 1], hsv converted
c = hsv2rgb(b) % [1 0 0], red again
  댓글 수: 2
Image Analyst
Image Analyst 2014년 3월 21일
If S and V are maxed out, that does not mean it's cyan.
Patrik Ek
Patrik Ek 2014년 3월 21일
Right sorry about that, I will change it.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2014년 3월 21일
Attached you'll find a very interesting demo converting rgb to hsv and lab for nearly all values of rgb. This is an adaptation/extension of something I got from Jeff Mather from the Mathworks imaging team. It really lets you see the "colors" of lab and hsv in different parts of their color space and for different "intensity" levels. As part of it, it does do the RGB to HSV conversion you are asking about. Shown below is one of the 4 figures it creates:

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by