Convert Colors from RGB to HSV in R Programming – rgb2hsv() Function
Last Updated :
30 Jun, 2020
rgb2hsv()
function in R Language is used to transform colors from RGB space(red / green / blue) into HSV space(hue / saturation / value).
Syntax: rgb2hsv(r, g, b)
Parameters:
r: vector of ‘red’ values.
g: vector of ‘green’ values, or NULL when r is a matrix.
b: vector of ‘blue’ values, or NULL when r is a matrix.
Example 1:
rgb = col2rgb( "# 08a0ff" )
rgb2hsv(rgb)
|
Output:
[, 1]
h 0.5641026
s 0.9686275
v 1.0000000
Example 2:
Output:
[, 1]
h 0.5833333
s 0.6666667
v 0.7058824
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...