Image is basically combination of individual pixel (dots) information. When we write that image is of 620 X 480 size, it means that image has 620 pixel in horizontal direction and 480 pixel in vertical direction. So, altogether there is 620 X 480 pixels and each pixels contains some information about image.
Grayscale image are basically those image which we say black and white image. Each pixel of grayscale image has a value lies in between 0 – 255 which decides at which position, the image will be black and at which position, it will be white.
If pixel value is 0, it means that pixel color will be fully black and if pixel value is 255, then that pixel will be fully white and pixel having intermediate value will be having shades of black and white.
We are given a Grayscale Image. Since pixel value of grayscale image lies between 0 -255, so its information is contained using 8 bit. So, we can divide those image into 8 planes (8 Binary Image). Binary image are those images whose pixel value can be either 0 or 1.
So, Our task is to extract each bit planes of original image to make 8 binary image
Let particular pixel of grayscale image has value 212. So, its binary value will be 11010100. So, its 1st bit is 0, 2nd is 0, 3rd is 1, 4rth is 0, 5th is 1, 6th is 0, 7th is 1, 8th is 1. In this manner, we will take these 8 bit of all pixel and will draw 8 binary image. We have to do this to all the pixels and generate new images.
Below is the implementation of above idea in matlab.
Below is screenshot of obtained output which are 10 images in 10 subplot. 1st one is original image. 2nd image is representation of extracted 1st bit (Least significant bit) image, 3rd one is of 2nd bit and so on. 9th image is extracted 8th bit (Most significant bit) image and 10th image is obtained after recombining of all 8 extracted bit.
Original Image Reference : Here
This article is contributed by Aditya Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.