IP Experiment 5 An
IP Experiment 5 An
TOOL:- Python
THEORY:-
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:-
CODE:-
import numpy as np
import cv2
plt.subplot(2, 5, 1)
plt.title('ORIGINAL')
plt.imshow(c, cmap='gray')
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)
bitPlane.append(a)
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)
plt.subplot(2, 5, k+2)
plt.title(f'BP-{k}')
plt.imshow(img, cmap='gray')
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.