The following readme has been written in markdown and should therefore be viewed with the proper format for optimal clarity.
├── README.md
├── Stochastic_Analysis.ipynb
├── prototyping
│ ├── obj.py
│ ├── processing.py
│ ├── test.png
│ └── validation.ipynb
├── requirements.txt
├── scripts
│ ├── autotest.py
│ ├── postprocess.py
│ ├── preprocess.py
│ └── utils.py
├── src
│ └── imaging
│ ├── Makefile
│ ├── conv.c
│ ├── conv.h
│ ├── filter.c
│ ├── filter.h
│ ├── fourier.c
│ ├── fourier.h
│ ├── image.c
│ ├── image.h
│ ├── main.c
│ ├── processmake
│ ├── utils.c
│ └── utils.h
└── test.png
The project provides implementations from scratch!!! of classical image denoising algorithms that include:
Image Convolutions - src/imaging/conv.c
Fourier Transforms (DFT and FFT) - src/imaging/fourier.c
Image and complex image structures can be found in src/imaging/image.c
while filter structures are found in src/imaging/filter.c
Note: A test image has been provided in root! please use this for simplicity!
Pre and Post processing of images are done using Python, whose requirements are found in the root directory of the project and are to be installed via:
pip install -r requirements.txt
If any issues persist with installations, please pip install numpy
and pip install opencv-python
.
Note: use pip install jupyter
if you would like to look at notebooks. To run notebooks, pip install matplotlib
Done once! Colored images in .jpg or .png are converted from RBG to grayscale, resampled, and flattened into .txt
files for processing. Preprocess pipeline creates a clean.txt and noise.txt outputs where a noise image is created to validate the algorithms below.
1 .python scripts/preprocess.py --input <full path to image> --output <directory of .txt creation> --size <target image size 2^n>
2. clean.txt and noise.txt created in output directory
Optional cmds are:
--r_noise <range of additive noise ~ default 15>
--p_noise <probability of additive noise ~ default 0.5>
Note: image size must be of base power 2: {2, 4, 16, 32, 64, 128, 256, 512}
cd src/imaging
(navigate into the directory containing the Makefile)make processmake
(build the executable)./processmake -c <full path to the target directory containing input txt> <input txt filename> <size of img> <sigma of kernel as float> <size of kernel eg: 3, 5, 7>
- output.txt contains the resulting image and logging.txt contains the parameters we used (located in same directory as specified)
Note: image size must be identical to that selected in preprocessing
Note: kernel size must be odd and smaller than size of image
cd src/imaging
(navigate into the directory containing the Makefile)make processmake
(build the executable)./processmake -f <full path to the target directory containing input txt> <input txt filename> <size of img ideally <=32, eg: 32> <r value as float: eg: 1.0>
- output.txt contains the resulting image and logging.txt contains the parameters we used (located in same directory as specified)
Note: sizes of >128 will take too long
cd src/imaging
(navigate into the directory containing the Makefile)make processmake
(build the executable)./processmake -t <full path to the target directory containing input txt> <input txt filename> <size of img, eg: 32, 128, 512> <r value as float: eg: 1.0>
- output.txt contains the resulting image and logging.txt contains the parameters we used (located in same directory as specified)
Compute PSNR metrics and add to logging.txt, create .jpg for output.txt file
python scripts/postprocess.py --input <full path to directory of .txt files>
- logging.txt updated
- output.jpg created
mkdir experiment
python scripts/preprocess.py --input ./test.png --output ./experiment --size 256
cd src/imaging
make processmake
./processmake -t ../../experiment/ noise.txt 256 0.3
cd ../../
python scripts/postprocess.py --input ./experiment
Note: Repeat steps 5 - 7 as needed
Runs a set of configs to compure batch ffts and persist info. Please edit configs before running or else! Run from root!
python scripts/autotest.py --input <full path to test img>