Bitplaning means to extract information of an image along only a single bit position. In case of multiple bit positions, you can choose to either binary threshold it to see more clearly the lower intensity bits. Bitplaning along all planes simultaneously without thresholding it will give you back the original image.
This module allows you to extract from single/multiple bit positions.
Copy the bitplaning module (bitplane.py) to your working directory and import it
import bitplane
- Read the image using openCV in grayscale
- Pass the image to bitplane.bit_plane
- (Optional) perform intensity thresholding with bitplane.threshold_image
img = cv2.imread(args.image_file, 0)
bitplaned_img = bit_plane(img, planes)
python bitplane.py <input-image> --bitplane [...planes to bitplane(0-7)]
# bitplane along Most significant bit
python bitplane.py test2.png --bitplane 7