Posts

Showing posts from October, 2018

Convert 3 channel black and white image to Binary

Image
If you have only 2 colors in your image lets say black and white(it can be any other color also) and want to convert it into a binary image, you can convert it using the method shown below.  A black and white images can be created in 2 ways  1. Where each pixel in image is represented by 3 values (Red,Green,Blue). In this case the pixels representing white are represented by RGB value (255,255,255)  while the black pixels are represented by RGB values (0,0,0).  This type of image is still called an RGB image because it has 3 channels. 2. Another way to create a black and white image is to create a single channel grayscale image,  where each pixel is represented by only one value between 0 and 255, where 0 is black and 255 is white. Values between 0 to 255 corresponds to intermediate values of black being converted to white (as in the different shades of gray). If you have an image that falls into category of what is described in 1  (for example see the image below