READ ME
_______________________________________________________________


Plug-and-Play Inpainting Software, Version 0.0, July 06, 2016.

Suhas Sreehari and Prof. Charles A. Bouman.
Purdue University, School of Electrical and Computer Engineering.

Collaborators:
S. V. Venkatakrishnan (Lawrence Berkeley National Lab), Brendt Wohlberg (Los Alamos National Lab), Lawrence F. Drummy (AFRL), Jeffrey P. Simmons (AFRL), and Prof. Gregery T. Buzzard (Purdue University, Mathematics Department).

_______________________________________________________________
The software for the Plug & Play InPainting needs to be run in MATLAB 2016B.

RUNNING THE DEMOS:

SUPER RESOLUTION:
1. Open MATLAB 2016B. 
2. Move the PlugAndPlay_SuperResolution_v3 directory to your MATLAB directory. 
3. Navigate to the PlugAndPlay_SuperResolution_v3 directory.
4. Run DEMO.m

INPAINTING:

1. Open MATLAB 2016B. 
2. Move the PlugAndPlay-InPainting-v0.0 directory to your MATLAB directory. 
3. Navigate to the PlugAndPlay-InPainting-v0.0 directory.
4. Run DEMO.m

Make sure that you only have one of either Plug & Play InPainting or Plug & Play Super Resolution on your MATLAB path at any given time, as several of the functions used by both have the same name.

_______________________________________________________________
RUNNING ANYTHING ELSE:

SUPER RESOLUTION:
In the Super Resolution Plug & Play function to use priors other than BM3D, you should change the prior in Line 16. Options for this are 

prior=0: K-SVD
prior=1: BM3D
prior=9: NLM
prior=10: LB-NLM

If you want to run the demo using this different prior, you'll need to change the prior on line 13 of the demo to the corresponding prior's number.

____________________________
K-SVD PRIOR:
For K-SVD, you will need to follow the instructions in the Read Me's for ompbox10 and ksvdbox13 [1] respectively. They require that your machine have a C compiler compatible with MATLAB. Recommendations for this are available on the Mathworks website.

To run the software, move the appropriate folder into your MATLAB 2016B directory, the folder and all subfolders to the path, navigate to that folder in MATLAB, and run the DEMO.m. All of the functions necessary for the Inpainting demo are contained in PPInpaintingLib, and all of the functions necessary for the Super Resolution demo are contained in Supporting_Code. It is important that the 'private' folder in ompbox10 and ksvdbox13 is NOT on the path.
____________________________

INPAINTING:
This version supports BM3D [2] as the prior model.

If you want to run the InPainting demo on your own image, follow the following steps.

1. Save your ground truth image in the Images folder.
2. Use the generateMask function with its dimensions and your preferred sampling percentage, i.e. mask = generateMask(h,w, percentage). Take the generated mask from the workspace, drag it to the Images folder and name it imagename_mask.mat
3. Apply the mask to the ground truth to get a sampled image. 
	i. First, convert your image to a double using MATLAB's im2double function. 
	ii. You can then apply the sample.m function from the Supporting Code folder to get your sampled image's matrix. 
	iii. Finally use imwrite(mat2gray(img), 'imagename.png') to write the sampled image.

 Make sure that your sampled image is also in the Images folder.

4. Change the variable names on lines 8, 9, 10, 36 in the demo.m file to match the name, extension, and mask for your image.
_______________________________________________________________

Please cite our work if you use this software for your paper.

BibTex entries:

@inproceedings{venkatakrishnan2013plug,
  title="Plug-and-Play priors for model based reconstruction",
  author="Singanallur V. Venkatakrishanan and Charles A. Bouman and Brendt Wohlberg",
  booktitle={2013 IEEE Global Conference on Signal and Information Processing (GlobalSIP)},
  pages={945--948},
  year={2013},
  organization={IEEE}
}

@article{sreehari2016,
  title={Plug-and-play priors for bright field electron tomography and sparse interpolation},
  author={Suhas Sreehari and S. Venkat Venkatakrishnan and Brendt Wohlberg and Gregery T. Buzzard and Lawrence F. Drummy and Jeffrey P. Simmons and Charles A. Bouman},
  journal={IEEE Trans. on Computational Imaging},
  volume="2",
  number="4",
  month="December",
  year="2015"
}

_______________________________________________________________

References:
[1] Weiyang Lieu et al., "Joint Kernel Dictionary and Classifier Learning for Sparse Coding via Locality Preserving K-SVD", 2015 IEEE International Conference on Multimedia and Expo (ICME), Turin, 2015, pp. 1-6.
[2] K. Dabov et al., “Image denoising by sparse 3-D transform-domain collaborative filtering,” IEEE Transactions on Image processing, Vol. 16, No. 8, pp. 2080-2095, 2007.

_______________________________________________________________




