RGB2Gray: Converting an RGB image to a grayscale image

Description Usage Arguments Value Examples

Description

This function is used to convert an RGB image to Grayscale.

Usage

1
Color2Gray(image, weight = c(0.299, 0.587, 0.114))

Arguments

image

an array of an RGB image file for processing.

weight

a numeric vector, giving weights for the Red, the Green and the Blue channels of the image, respectively.

Value

image

A matrix of pixels of the image converted from RGB to Grayscale.

Examples

1
2
3
4
5
6
#read an RGB image
library(png)
image = readPNG(system.file("extdata", "image1.png",
                             package = "implant",
                             mustWork = TRUE))[ , ,c(1:3)]
imageGray = Color2Gray(image)

rwang14/implant documentation built on Sept. 6, 2020, 3:21 a.m.