JasPer: The imgcmp Program

JasPer 3.0.6 |

The imgcmp Program

# The imgcmp Program

## Synopsis

`imgcmp` [options]

## Description

The imgcmp command compares two images. The two images being compared must have the same geometry (i.e., the same width, height, number of components, component subsampling factors, etc.).

## Options

The following options are supported:

- `-f $file`
  - Read the primary (i.e., reference) image (for comparison purposes) from the file named `$file`.
- `-F $file`
  - Read the secondary image (for comparison purposes) from the file named `$file`.
- `-m $metric`
  - Use the difference metric specified by `$metric`. The `$metric` argument may assume one of the following values:
    - `psnr`: peak signal to noise ratio (PSNR)
    - `mse`: mean squared error (MSE)
    - `rmse`: root mean squared error (RMSE)
    - `pae`: peak absolute error (PAE)
    - `mae`: mean absolute error (MAE)
    - `equal`: equality

The `-f` and `-F` options must always be specified. There is currently no way to explicitly specify the format of the images. If the format of either image cannot be autodetected, the command will exit with an error.

## Examples

Suppose that we have two slightly different versions of an image stored in files `original.pgm` and `reconstructed.pgm`. In order to calculate the difference between these images using the PSNR metric, use the command:

    imgcmp -f original.pgm -F reconstructed.pgm -m psnr