Example #1
0
//' @export
// [[Rcpp::export]]
NumericVector RGBtoHSL(NumericVector im) {
    CImg<double> img = as<CImg<double> >(im);
    img.RGBtoHSL();
    return wrap(img);
}
Example #2
0
//' Convert an RGB image to grayscale
//'
//' This function converts from RGB to grayscale by first converting to HSL and keeping only the L channel
//' @return a grayscale image (spectrum == 1)
//' @export
// [[Rcpp::export]]
NumericVector grayscale(NumericVector im) {
    CImg<double> img = as<CImg<double> >(im);
    return wrap(img.RGBtoHSL().get_channel(2));
}