RGB2Gray

Context:

Many functions require your input image to be in grayscale. Color images are in the form of RGB, a continuous trait as opposed to discrete values. This causes problems in analysis, therefore, conversion to discrete values between 0-255 (black pixels - white pixels) is ideal. Where gray pixels, are any values between black-white.

Arguments:

  • Requires a path to your image.

Code:

Results:

_images/pig.png

Original Raw Image

_images/gray.png

This is what our pig looks like in grayscale