Copyright (C) 2012 Telematic and Telecommunication Laboratory (LTT),     
Dipartimento di Ingegneria dell'Informazione - Università di Siena                        
via Roma 56, 53100, Siena, Italy

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.


***************
*   NOTICE    *
***************
This software makes use of the following scripts (contained in the archive) 
licensed by their own authors.
- funcVarianceMap.m (Copyright Siddhant Ahuja, 2008, see the script for more details)
- ssim_index.m (Copyright(c) 2003 Zhou Wang, see the script for more details)
- psnr_mse_maxerr Copyright 1995-2008 The MathWorks, Inc. (see the script for more details)
Be aware that some of the licenses may be more restrictive than this one, read them carefully.

The histogram dabatase has been obtained from 25.000 images of the 
MIRFLICKR database (Offered by the LIACS Medialab at Leiden University, The Netherlands))

***************
* Description *
***************   
This archive includes a Matlab implementation of an algorithm used to remove traces left by a generic 
processing in the histogram of an image, as decribed in M. Barni, M. Fontani, B. Tondi, "A Universal 
Technique to Hide Traces of Histogram-Based Image Manipulations", ACM Int. Workshop on Multimedia and 
Security (MMSEC) 2012, Coventry, UK, 2012.
 
	
************
* Platform *
************      
Matlab 7.4.0 (R2007a) (should work also on newer versions)
Makes use of Image Processing Toolbox
Makes use of SSIM Index, Version 1.0 (Copyright(c) 2003 Zhou Wang, see license into ssim_index.m)
Makes use of AMPL and ipopt

**************
*Environment *   
**************
Tested on Linux (Ubuntu 10.4) and Windows (XP and 7)
Notice: this version of the code uses AMPL and ipopt to solve the optimization
problem. The student version (free) of AMPL may not be sufficient.
Feel free to change the code to include different modeling languages and/or solvers.

************************
*Component Description *
************************
histogram_universal_antiforensics.m: main file, produces counter-forensic image (with "cleaned" histogram)
demo.m: simple demonstator
MIRFLICKR.mat contains histograms of 25.000 images coming from the MIRFLICKR
database (Offered by the LIACS Medialab at Leiden University, The Netherlands)
All other components are self-documented, please refer to scripts.

***********************
* Set-up Instructions *  
***********************
Extract all files to a single directory. Add the directory to the Matlab path, or set it as the current Matlab directory
If still not available, install AMPL (www.ampl.com) and solvers. AMPL must
be in the system path and must be able to call solvers properly. 
Notice that student version of AMPL may not be sufficient to solve the optimization problem.


********************
* Run Instructions *
********************      
Run demo.m for a demonstration (a demo img is included)

**********************
* Output Description *
**********************
The output variable ('remapped') is the counter-forensic version of the processed image.
This image will (hopefully) be very similar to the attacked one, but should not show anomalous statistical traces in the histogram

***********************
* Contact Information *
***********************
marco.fontani@unisi.it
