A Survey of Gaussian Convolution Algorithms
Data Structures | Macros | Enumerations | Functions
imdiff.c File Reference

Image difference calculator program. More...

Detailed Description

Image difference calculator program.

Author
Pascal Getreuer getre.nosp@m.uer@.nosp@m.cmla..nosp@m.ens-.nosp@m.cacha.nosp@m.n.fr

This file implements the imdiff program, a command line tool for comparing two images with various image quality metrics. The possible metrics are

where N is the number of pixels and subscript n denotes the nth pixel.

The program can also create a difference image, computed as

\[ D_n = 255/20 (A_n - B_n) + 255/2 \]

where values outside of the range [0,255] are saturated.

Note
Image alpha channels are ignored. Also beware that although the program can read 16-bit PNG images (provided USE_LIBPNG is enabled), the image data is quantized internally to 8 bits.

Copyright (c) 2010-2013, Pascal Getreuer All rights reserved.

This program is free software: you can redistribute it and/or modify it under, at your option, 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, or the terms of the simplified BSD license.

You should have received a copy of these licenses along with this program. If not, see http://www.gnu.org/licenses/ and http://www.opensource.org/licenses/bsd-license.html.

Definition in file imdiff.c.

#include <ctype.h>
#include <math.h>
#include <string.h>
#include "imageio.h"

Go to the source code of this file.

Data Structures

struct  programparams
 struct of program parameters. More...
 

Macros

#define DISPLAY_SCALING   255
 Display metrics for intensities in the range [0,DISPLAY_SCALING].
 

Enumerations

enum  metric_t {
  DEFAULT_METRICS, MAX_METRIC, MSE_METRIC, RMSE_METRIC,
  PSNR_METRIC
}
 enum of possible metrics
 

Functions

void make_difference_image (float *A, const float *B, int width, int height, int num_channels, float D)
 Make a difference image, diff = (A - B) / D + 0.5.
 
void basic_metrics (float *max_diff, float *mse, const float *A, const float *B, int width, int height, int num_channels, int pad)
 Compute the maximum absolute difference and the MSE.
 
int parse_params (programparams *param, int argc, char *argv[])
 Parse parameters from command line arguments.
 
void print_help_message ()
 Print program usage help message.
 
int main (int argc, char *argv[])