pkdiff - program to compare two raster image files
Contents
Description
pkdiff compares two datasets. The reference can either be a raster or a vector, but the input must be a
raster dataset. In case the reference is a raster dataset, a pixel by pixel comparison is performed.
With no further options, the utility reports if the rasters are identical or different. If required, an
output raster dataset can be written with a qualitative information per pixel: 0 (input=reference), 1
(input>reference) or 2 (input<reference). If, however, the reference is a vector dataset, it must con‐
sist of point features. Polygon features are automatically converted to the centroid points before ana‐
lyzing.
A typical use of the utility is to assess the accuracy of an input raster land cover map, based on a ref‐
erence vector dataset. The reference dataset must contain an attribute (label) for each class. A confu‐
sion matrix is produced if the option -cm|--confusion is set. Here too, an output dataset can be writ‐
ten, which will be a vector dataset in this case. It contains the reference feature points with the ex‐
tracted data value of the raster input dataset as a new attribute.
Example
Check if two raster images are different (reports only if images are different or not)
pkdiff-iinput.tif-refreference.tif
Validate a classification map using points from a reference sample and report confusion matrix
pkdiff-iclassificationMap.tif-refreferencePoints.tif-cm
01 January 2025 pkdiff(1)
Name
pkdiff - program to compare two raster image files
Options
-ifilename, --inputfilename
Input raster dataset.
-reffilename, --referencefilename
Reference (raster or vector) dataset
-lnlayer, --lnlayer
Layer name(s) in sample. Leave empty to select all (for vector reference datasets only)
-bband, --bandband
Input raster band
-cm, --confusion
Create confusion matrix (to stdout)
-lrattribute, --lrefattribute
Attribute name of the reference label (for vector reference datasets only)
-cname, --classname
List of class names.
-rvalue, --reclassvalue
List of class values (use same order as in classname option).
-nodatavalue, --nodatavalue
No data value(s) in input or reference dataset are ignored
-mmask, --maskmask
Use the first band of the specified file as a validity mask. Nodata values can be set with the
option --msknodata.
-msknodatavalue, --msknodatavalue
Mask value(s) where image is invalid. Use negative value for valid data (example: use -t -1: if
only -1 is valid value)
-vlevel, --verboselevel
verbose level
Advanced options
-ooutput, --outputoutput
Output dataset (optional)
-fOGRformat, --fOGRformat
OGR format for output vector (for vector reference datasets only)
-ofGDALformat, --oformatGDALformat
Output image format (see also gdal_translate(1)). Empty string: inherit from input image
-lcattribute, --lclassattribute
Attribute name of the classified label (for vector reference datasets only)
--commissionvalue
Value for commission errors: input label < reference label
-bndvalue, --boundaryvalue
Boundary for selecting the sample (for vector reference datasets only)
-hom, --homogeneous
Only take regions with homogeneous boundary into account (for reference datasets only)
-circ, --circular
Use circular boundary (for vector reference datasets only)
-ctcolortable, --ctcolortable
Color table in ASCII format having 5 columns: id R G B ALFA (0: transparent, 255: solid).
-coNAME=VALUE, --coNAME=VALUE
Creation option for output file. Multiple options can be specified.
Synopsis
pkdiff-iinput-refreference [options] [advancedoptions]
