# rgb2hsv functions mathmatical formula

61 views

### Fatih Ozcelik

Dec 28, 2009, 11:22:04 AM12/28/09
to
is there anybody knows; matlab uses which mathmatical formula rgb to hsv (rgb2hsv)function?

### ImageAnalyst

Dec 28, 2009, 11:27:49 AM12/28/09
to
On Dec 28, 11:22 am, "Fatih Ozcelik" <mfozce...@hotmail.com> wrote:
> is there anybody knows; matlab uses which mathmatical formula rgb to hsv (rgb2hsv)function?

---------------------------------------------
Just dive into the code - they gave it to you. Just put the cursor on
the function rgb2hsv() in your code and type control-d. Here's the
(By the way, here's another site you may like: http://www.easyrgb.com/index.php?X=MATH)

%RGB2HSV Convert red-green-blue colors to hue-saturation-value.
% H = RGB2HSV(M) converts an RGB color map to an HSV color map.
% Each map is a matrix with any number of rows, exactly three
columns,
% and elements in the interval 0 to 1. The columns of the input
matrix,
% M, represent intensity of red, blue and green, respectively. The
% columns of the resulting output matrix, H, represent hue,
saturation
% and color value, respectively.
%
% HSV = RGB2HSV(RGB) converts the RGB image RGB (3-D array) to the
% equivalent HSV image HSV (3-D array).
%
% CLASS SUPPORT
% -------------
% If the input is an RGB image, it can be of class uint8, uint16,
or
% double; the output image is of class double. If the input is a
% colormap, the input and output colormaps are both of class double.
%

% Undocumented syntaxes:
% [H,S,V] = RGB2HSV(R,G,B) converts the RGB image R,G,B to the
% equivalent HSV image H,S,V.
%
% HSV = RGB2HSV(R,G,B) converts the RGB image R,G,B to the
% equivalent HSV image stored in the 3-D array (HSV).
%
% [H,S,V] = RGB2HSV(RGB) converts the RGB image RGB (3-D array) to
% the equivalent HSV image H,S,V.
%
% See Alvy Ray Smith, Color Gamut Transform Pairs, SIGGRAPH '78.

% Copyright 1984-2006 The MathWorks, Inc.
% \$Revision: 5.15.4.2 \$ \$Date: 2006/10/02 16:33:03 \$