Skip to content

Tag: rgb

Image convertion to GrayScale/Binary/R/G/B


This is a small exercice of Multimedia class (INE5431). We need to implement:

1) Transform the image to GrayScale
2) Generate one image to each component color (R/G/B)
3) Transform the GrayScale image to binary

To transform RGB to GrayScale we need to use this expression:

Y = 0.3R + 0.59G + 0.11B;

And them, to convert the GrayScale to Binary

if (Y > 127) {b = 1; } else { b = 0; }

If we want just one color component, we need to get all image pixels and leave just the component that we want, or just copy the component to a new image.

In this project, we access an image and we have some functions to do what we want, convertion to GrayScale, Binary, and Component RGB. From the source image, we create a buffer image of the same size to all images and we create a for to go over all pixels and make the transformation and put it to the new buffer image.

Continue reading Image convertion to GrayScale/Binary/R/G/B