0% found this document useful (0 votes)
22 views4 pages

IP Experiment 5 An

The document outlines an experiment on Bit Plane Slicing, a technique in image processing that decomposes an image into multiple bit planes to analyze their significance. It includes a Python code implementation for extracting and visualizing bit planes from an 8-bit grayscale image, demonstrating applications such as image compression and feature extraction. The conclusion emphasizes the importance of understanding bit-level image representation for various practical applications in modern image processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

IP Experiment 5 An

The document outlines an experiment on Bit Plane Slicing, a technique in image processing that decomposes an image into multiple bit planes to analyze their significance. It includes a Python code implementation for extracting and visualizing bit planes from an 8-bit grayscale image, demonstrating applications such as image compression and feature extraction. The conclusion emphasizes the importance of understanding bit-level image representation for various practical applications in modern image processing.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

EXPERIMENT - 5

AIM:- To study Bit Plane Slicing.

TOOL:- Python

THEORY:-

Bit Plane Slicing is a technique in image processing that involves decomposing an


image into multiple bit planes to analyze the significance of each bit in forming the
image. In an 8-bit grayscale image, each pixel is represented by an 8-bit binary
number, with bit-plane 0 corresponding to the Least Significant Bit (LSB) and bit-
plane 7 to the Most Significant Bit (MSB). The higher-order bits (6 and 7) contain
most of the meaningful information, such as major intensity variations and essential
structural details, whereas the lower-order bits (0 and 1) contribute to finer details
and subtle variations, often susceptible to noise.

Bit Plane Slicing is particularly useful in image compression, where only the most
significant bits are retained to reduce file size without significant loss of information.
It is also applied in feature extraction, where important structures in an image can
be highlighted by isolating specific bit planes. Additionally, steganography makes
use of lower-order bit planes to hide information in images without visibly altering
them. The technique is also beneficial in noise reduction, as eliminating the lower bit
planes helps remove random noise without affecting the primary features of the
image.

By visualizing and analyzing individual bit planes, one can better understand how
different bits contribute to the overall image structure. The process of reconstructing
an image by selectively combining essential bit planes ensures that only the most
relevant details are preserved. Bit Plane Slicing, therefore, plays a crucial role in
various applications, providing an effective way to manipulate and analyze images at
a granular level.
ALGORITHM:-

1. Read i/p image


2. Use bit and operation to extract each bit
3. Do the step 2 for every pixel.
4. Display the original image and the biplanes formed by bits extracted

CODE:-

import numpy as np

import cv2

import matplotlib.pyplot as plt

# Load the image in grayscale

img1 = cv2.imread('Panda.jpeg', cv2.IMREAD_GRAYSCALE)

c = np.array(img1) # No need to use .data

plt.figure(figsize=(12, 6)) # Adjust figure size

# Display the original image

plt.subplot(2, 5, 1)

plt.title('ORIGINAL')

plt.imshow(c, cmap='gray')

# Initialize finalImage as a zero matrix

finalImage = np.zeros_like(c, dtype=np.uint8)

# Extract bit planes

for k in range(8):

bitPlane = []

for i in range(c.shape[0]):

a = []
for j in range(c.shape[1]):

if c[i, j] % 2 == 1:

a.append(255)

else:

a.append(0)

c[i, j] = c[i, j] // 2 # Integer division

bitPlane.append(a)

img = np.array(bitPlane, dtype=np.uint8)

# Reconstruct the image from bit planes

for i in range(c.shape[0]):

for j in range(c.shape[1]):

if img[i, j] == 255:

finalImage[i, j] += np.power(2, k)

# Display each bit plane

plt.subplot(2, 5, k+2)

plt.title(f'BP-{k}')

plt.imshow(img, cmap='gray')

# Display the reconstructed image

plt.subplot(2, 5, 10)

plt.imshow(finalImage, cmap='gray')

plt.title('RECONSTRUCTED')

plt.tight_layout()

plt.show()
RESULT:-

CONCLUSION:-

Through this project, we have demonstrated how different bit planes influence image
quality and how selective reconstruction can be used for various applications. The
practical applications of Bit Plane Slicing, such as image compression, feature
extraction, and secure data hiding, highlight its importance in modern image
processing techniques. Understanding bit-level image representation provides deeper
insights into digital image formation and manipulation, making this approach highly
valuable in both academic and industrial settings.

You might also like