[R-sig-Geo] Calculate HIS/HSV values from RGB raster image

Robert J. Hijmans r.hijmans at gmail.com
Sat Oct 17 02:03:46 CEST 2015


Kevin,

I think you can do that like this:

library(raster)
b <- brick(system.file("external/rlogo.grd", package="raster"))

hsv <- overlay(b, fun=rgb2hsv)


Best, Robert

On Fri, Oct 16, 2015 at 3:52 PM, Kevin Wolz <wolz1 at illinois.edu> wrote:
> Does anyone know if there is any pre-existing functionality to easily
> calculate hue, saturation, and intensity (HSI or HSV or HIS) from RGB
> raster layers?
>
> There is the "rgb2hsv" function in the grDevices packages, but that works
> on vectors or matrices of rgb values. The functions for calculating HSI
> from RGB are fairly straightforward, so it' would be that bad to directly
> calculate new raster layers from the RGB layers, but I'm wondering if there
> are any preexisting functions. I can't seem to find any.
>
> Thanks!
> Kevin
>
> --
> Kevin Wolz
> PhD Candidate, DeLucia Lab
> University of Illinois at Urbana-Champaign
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list