This archive contains a command line tool (pgmtool v. 0.72b) for performing on PGM P5 and RAW grayscale images transformations including: resizing, cropping, changing bit depth or endianness, adding noise, softening. This archive contains files: * Win32 executable: pgmtool.exe * C++ source code of the tool: pgmtool.cpp - main module, crc_32.cpp and crc_32.h - CRC32 routines by Gary S. Brown, rand.cpp and rand.h - ISAAC random number generator by Bob Jenkins * this file (readme.txt) Further description (the same will be outputted by the tool invoked with no arguments): pgmtool v. 0.72b, (c) 2015 Roman Starosolski, rstarosolski@polsl.pl Perform transformations on PGM P5 and RAW grayscale images. This software is intended for research purposes only; it is provided "as is"; author makes no warranty of any kind, either express or implied, with respect to this software. This software uses CRC32 routines by Gary S. Brown and ISAAC random number generator by Bob Jenkins. This work was partially supported by POIG.02.03.01-24-099/13 grant: GeCONiI - Upper-Silesian Center for Scientific Computations. Commandline syntax (fixed commandline order: -i switches, infilename, one or no -t switch, one or no -o switch, outfilename): [-i:RAW:width:height[:bpp[:skip]]] RAW image dimensions, depth (default 16 bits) and starting offset (default: 0) [-i:RAW:like:PGMP5filename] Load RAW image dimensions and depth from PGM P5 file PGMP5filename, starting offset=0 [-i:endian:Little|Big] endianness of the input file, default:BigEndian infilename input file name with extension, PGM P5 assumed if no -i:RAW specified, pixel intensities assumed unsigned, before inputting image pixels pgmtool reports: ImgFileName -image file name ImgImageWidth -width ImgImageHeight -height ImgBYTEpp -file Bytes per pixel Imgbpp -nominal bits per pixel ImgLevelMax -nominal maximum intensity ImgBigEndian -is image BigEndian? ImgRaw -is it RAW ImgRawSkip: -file offset of image data after inputing image pgmtool reports: minLevel -actual minimum intensity maxLevel -actual maximum intensity numLevels -actual number of intensities bitsUsed -word bits used by any pixel H0 -memoryless entropy of pixels in bits, Bytes and bits per pixel CRC32 -CRC32 checksum of pixels and pixels' Bytes (BigEndian assumed) [-t:noise:percent] replace percent% [0, 100] of image pixels with noise of uniform distribution [-t:addnoise:percent] replace percent% of each pixel's intensity with uniform noise [-t:spnoise:percent] replace percent% [0, 100] of image pixels with Salt and Pepper impulse noise [-t:wgnoise:deviation] add White Gaussian noise (of given standard deviation /double type/) to all image pixels [-t:soften:radius:centerweight:neighborweight] soften image by replacing each pixel with weigted average of that pixel (weight: centerweight) and neighbors in 8-neighborhood (weight of each: neighborweight) distant by no more than radius, use negative neighborweight to sharpen instead [-t:softensquared:radius:centerweight:neighborweight] as soften, but using squared pixel intensities [-t:denoise:radius:mode] denoise image by taking from pixel's 8-neighborhood of given radius (from the window) the: mode=0 - window median mode=1 - median, if pixel is greater than or smaller than all other pixels in the window (RCRS-1) mode=2 - 2nd greatest or smallest pixel, if it is the greatest or the smallest resp. mode=3 - 2nd greatest or smallest window pixel value, but not smaller or greater resp. than median, if pixel is the greatest or the smallest resp. (RCRS-2) [-t:decorrelate] subtract from each pixel average of upper and left neighbor (Imgbpp++) [-t:correlate] undo decorrelate [-t:decorrelatemed] decorrelate using median edge detector (MED) predictor from JPEG-LS standard (Imgbpp++) [-t:correlatemed] undo decorrelatemed [-t:downsize:times] reduce image size, times in range [1, 100] by averaging times x times pixel blocks [-t:crop:x0:y0:newwidth:newheight] crop image, x0,y0 - top left corner [-t:reducedepth:newdepth] reduce depth right-shifting intensities, newDepth in range [1, InImgbpp) [-t:cropdepth:newdepth] reduce nominal depth keeping intensities, report error if intensity exceeds new nominal depth [-t:cropdepthlike:PGMP5filename] reduce nominal depth to depth of PGM P5 image [-t:cropclipdepth:newdepth] reduce nominal depth clipping too large intensities to top of allowable range [-t:increasedepth:newdepth:mode] increase image depth, newdepth <= 16 mode=0 - nominal only, keeping intensities mode=1 - nominal and left-shifting intensities [-t:negendian] invert image endianness (Big<->Little) [-t:xorfile:xorfname] perform xor on image pixels with file xorfname containing BigEndian ImgBYTEpp-Byte unsigned numbers whose bits exceeding Imgbpp are ignored [-o:RAW] output image as RAW, otherwise PGM P5 outfilename output file name Examples: Soften lena.pgm, save as PGM pgmtool lena.pgm -t:soften:1:8:1 lena_s.pgm Replace 10% of pixels in lena.pgm image with noise(uniform distribution), save resulting file as RAW pgmtool lena.pgm -t:noise:10 -o:RAW lena_n.raw Input lena_n.raw RAW image assuming dimensions and depth as in lena.pgm, save as 16-bit BigEndian PGM pgmtool -i:RAW:like:lena.pgm lena_n.raw -t:increasedepth:16:0 lena_16.pgm Convert BigEndian PGM image lena_16.pgm to LittleEndian RAW lena_16le.raw pgmtool lena_16.pgm -t:negendian -o:RAW lena_16le.raw Just display information on lena.pgm image pgmtool.exe lena.pgm