utils_colorspace | R Documentation |
rgb_to_srgb()
Transforms colors from RGB space (red/green/blue) to
Standard Red Green Blue (sRGB), using a gamma correction of 2.2. The
function performs the conversion by applying a gamma correction to the input
RGB values (raising them to the power of 2.2) and then transforming them
using a specific transformation matrix. The result is clamped to the range
0-1 to ensure valid sRGB values.
rgb_to_hsb()
Transforms colors from RGB space (red/green/blue) to HSB
space (hue/saturation/brightness). The HSB values are calculated as follows
(see https://www.rapidtables.com/convert/color/rgb-to-hsv.html for more
details).
Hue: The hue is determined based on the maximum value among R, G, and B, and it ranges from 0 to 360 degrees.
Saturation: Saturation is calculated as the difference between the maximum and minimum channel values, expressed as a percentage.
Brightness: Brightness is equal to the maximum channel value, expressed as a percentage.
rgb_to_lab()
Transforms colors from RGB space (red/green/blue) to CIE-LAB
space, using the sRGB values. See grDevices::convertColor()
for more
details.
rgb_to_hsb(object)
rgb_to_srgb(object)
rgb_to_lab(object)
object |
An |
A data frame with the columns of the converted color space
Tiago Olivoto tiagoolivoto@gmail.com
See the detailed formulas here
if(interactive()){
library(pliman)
img <- image_pliman("sev_leaf.jpg")
rgb_to_lab(img)
# analyze the object and convert the pixels
anal <- analyze_objects(img, object_index = "B", pixel_level_index = TRUE)
rgb_to_lab(anal)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.