decimate
Description
decimate downsamples an 8-bit OMG1 (JHC_header) raster by an integer factor -count <n> along both axes (or along a single axis via -justx or -justy). It supports either valid-pixel mean averaging (default) or minimum-value selection (-lowest), while excluding a user-specified background/no-data value (-ignore, default 255).
CLI Options & Usage
decimate -in <infile> -out <outfile> -count <n> \
[-justx | -justy] [-ignore <val>] [-lowest]
-in <infile>: Input 8-bitOMG1raster file.-out <outfile>: Output downsampled 8-bitOMG1raster file.-count <n>: Integer decimation factor (must be>= 1).-justx: Decimates horizontally (X) only, preservingymaxanddy.-justy: Decimates vertically (Y) only, preservingxmaxanddx.-ignore <val>: Background pixel value ignored during averaging/minimum calculation (default:255).-lowest: Retains the lowest valid Digital Number within eachxcount à ycountblock instead of the arithmetic mean.
Algorithm
- Divides
xmaxbyxcountandymaxbyycount, and multipliesdx *= xcountanddy *= ycountin the outputJHC_header. - For each output pixel
(i, j), inspects the correspondingxcount à ycountblock in the source image:- Accumulates all pixels
!= ignore(rounding the mean(sum + good/2) / good, or tracking the minimum if-lowestis set). - Outputs
ignore(255) if no valid pixels exist in the block.
- Accumulates all pixels