/bit-plane-slicing

Bit plane slicing data augmentation

Primary LanguagePythonMIT LicenseMIT

Bit Plane Slicing

Zeroize bit planes in 8-bit color images as a form of image augmentation. Bit plane slicing has previously been used for image compression.

Installing on Linux

$ git clone https://github.com/deanwetherby/bit-plane-slicing
$ cd bit-plane-slicing
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ python -m pip install --upgrade pip setuptools wheel
(venv) $ python -m pip install -r requirements.txt

Script usage

(venv) $ python main.py -h
usage: main.py [-h] [-i INPUT] [-o OUTPUT] [-p PLANE [PLANE ...]]

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Input image path
  -o OUTPUT, --output OUTPUT
                        Output image path
  -p PLANE [PLANE ...], --plane PLANE [PLANE ...]
                        Space separated list of bit planes to zeroize

Examples

original image.jpg

original

(venv) $ python main.py --input images/image.jpg --output images/output_0.jpg --plane 0

bit plane 0 (MSB)

(venv) $ python main.py --input images/image.jpg --output images/output_1.jpg --plane 1

bit plane 1 (MSB)

(venv) $ python main.py --input images/image.jpg --output images/output_2.jpg --plane 2

bit plane 2 (MSB)

(venv) $ python main.py --input images/image.jpg --output images/output_3.jpg --plane 3

bit plane 3 (MSB)

(venv) $ python main.py --input images/image.jpg --output images/output_4.jpg --plane 4

bit plane 4 (MSB)

(venv) $ python main.py --input images/image.jpg --output images/output_5.jpg --plane 5

bit plane 5 (MSB)

(venv) $ python main.py --input images/image.jpg --output images/output_6.jpg --plane 6

bit plane 6 (MSB)

(venv) $ python main.py --input images/image.jpg --output images/output_7.jpg --plane 7

bit plane 7 (MSB)

References

Wikipedia:bit plane

Bit plane slicing

Image Compression using bit planes