pkdiff(1)
β¨ pkdiff β bestie edition β¨
okay so you want to compare two raster images?? say less π
welcome to pkdiff, a lil program that compares two raster image files and tells you what's up. it's giving main character energy and honestly it ate.
πΈ NAME πΈ
pkdiff β the program that compares two raster image files. that's it. that's the whole vibe. π¦
β¨ SYNOPSIS β¨
pkdiff -i input -ref reference [options] [advanced options]
π DESCRIPTION π
okay so pkdiff compares two datasets. here's the tea tho: the reference can be either a raster or a vector, but the input has to be a raster dataset, periodt. no exceptions bestie.
when the reference is a raster dataset, you get a pixel by pixel comparison. iconic. and if you don't add any extra options, the utility just tells you whether the rasters are identical or different β that's it, that's the whole report. simple. clean.
but wait, there's more π if you want, you can write an output raster dataset with a lil qualitative piece of info per pixel:
0β input = reference1β input > reference2β input < reference
now if the reference is a vector dataset instead?? it has to consist of point features. and if you hit it with polygon features, they get automatically converted to the centroid points before analyzing. the utility said "not today polygons" π
a super typical use of this utility is assessing the accuracy of an input raster land cover map based on a reference vector dataset. the reference dataset must contain an attribute (label) for each class. a confusion matrix is produced if the option -cm|--confusion is set. and here too, an output dataset can be written β which will be a vector dataset in this case. it contains the reference feature points with the extracted data value of the raster input dataset as a new attribute. so organized. so slay. π
π OPTIONS π
-i filename,--input filenameβ Input raster dataset. yes you literally have to give it something to look at.-ref filename,--reference filenameβ Reference (raster or vector) dataset. this is the thing you're comparing against, bestie.-ln layer,--ln layerβ Layer name(s) in sample. Leave empty to select all (for vector reference datasets only). leave it blank and it grabs everything π«Ά-b band,--band bandβ Input raster band. which band are we looking at, hmm?-cm,--confusionβ Create confusion matrix (to stdout). the name is scary but it's just math, i promise π-lr attribute,--lref attributeβ Attribute name of the reference label (for vector reference datasets only).-c name,--class nameβ List of class names.-r value,--reclass valueβ List of class values (use same order as in classname option). keep the order matching, don't play yourself π-nodata value,--nodata valueβ No data value(s) in input or reference dataset are ignored. we simply do not perceive them β¨-m mask,--mask maskβ Use the first band of the specified file as a validity mask. No-data values can be set with the option--msknodata.-msknodata value,--msknodata valueβ Mask value(s) where image is invalid. Use negative value for valid data (example: use-t -1: if only-1is valid value). yes the negative means valid, it's confusing, i know, just go with it π-v level,--verbose levelβ verbose level. how much do you wanna hear about it? π
π₯ Advanced options π₯
-o output,--output outputβ Output dataset (optional). only if you want the receipts.-f OGRformat,--f OGRformatβ OGR format for output vector (for vector reference datasets only).-of GDALformat,--oformat GDALformatβ Output image format (see alsogdal_translate(1)). Empty string: inherit from input image. lazy girl friendly πΈ-lc attribute,--lclass attributeβ Attribute name of the classified label (for vector reference datasets only).--commission valueβ Value for commission errors: input label < reference label.-bnd value,--boundary valueβ 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). we're going in circles, literally π«-ct colortable,--ct colortableβ Color table in ASCII format having 5 columns:id R G B ALFA(0: transparent,255: solid). alpha but make itALFAiykyk.-co NAME=VALUE,--co NAME=VALUEβ Creation option for output file. Multiple options can be specified. stack 'em up bestie β¨
π EXAMPLE π
check if two raster images are different (reports only if images are different or not):
pkdiff -i input.tif -ref reference.tif
validate a classification map using points from a reference sample and report confusion matrix:
pkdiff -i classificationMap.tif -ref referencePoints.tif -cm
ngl bestie, if you got this far you're officially a raster girlie. go forth and diff. π
written 01 January 2025, from the pkdiff(1) manual β mwah, love u, bye π«Άβ¨
π¦ where this page comes from
- ubuntu questing: pktools 2.6.7.6+ds-6build4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms