NAME: Kamlesh Kumar CLASS: BSCS-10C DIP LAB 05 Lab 5 Image steganography Task #1: Bit Plane Slicing Perform bit slicing of an 8 bit greyscale image as discussed in the lecture. Start from the least significant bit and move towards the most significant bit. You will get eight binary images of the input image as demonstrated below. TASK CODE: import PIL from matplotlib import pyplot as plt from PIL import Image import numpy as np img = Image.open('lab05.tif') BitPlaneSize = 8; def stegnograph(level): x = np.array(img) level = 2 ** level # convert the image to ndarray # 2^level XOR_fun = lambda arg: arg & level # bitwise and with level number stegno_arr_func = np.vectorize(XOR_fun) # function to iterate every value of array through XOR_fun function y = stegno_arr_func(x) # using vectorized function to avoid for loops return y # return the new array for new image def disp(img): fig, axes = plt.subplots(nrows=2, ncols=4) for x in range(2): for y in range(4): axes[x, y].set_title("Level no" + str(4*x + y)) axes[x, y].imshow(stenograph(4*x + y),map='gray') disp(img) # calling disp function plt.show() # showing the plot OUTPUT