PGMKERNEL(1)

๐Ÿ“ฆ
version 11.13.03 ยท 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

๐Ÿ’– pgmkernel ๐Ÿ’–

okay bestie, welcome to the manual for pgmkernel โ€” aka the little Netpbm girlie who generates a convolution kernel. she's under the General Commands Manual umbrella, and I'm about to make her make sense. ๐ŸŽ€


โœจ NAME โœจ

pgmkernel โ€” generate a convolution kernel


๐ŸŒธ SYNOPSIS ๐ŸŒธ

pgmkernel [-weight=number] [-maxval=] {size | width height}

a few little quality-of-life notes so you don't fumble the bag: Minimum unique abbreviation of the option is acceptable. you can also use double hyphens instead of a single hyphen to denote options. and yes bestie, you may use white space in place of the equals sign to separate an option name from its value. ๐Ÿ’…


๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so this program is part of Netpbm(1) ๐Ÿซถ

pgmkernel generates a convolution kernel that you can use with pnmconvol. the vibe of this kernel is very specific: the weight of each location is inversely proportional to its distance from the center of the kernel. the further out you go, the less it matters. main character stays in the middle. ๐Ÿ‘‘

pgmkernel generates a PGM image of width and height size if you specify one argument, or width width and height height if you specify two arguments.

and here's the actual math, because she's giving STEM girlie and we respect her for it โ€” pgmkernel computes the convolution function K as follows. ๐Ÿงฎ

K(i,j) = 1 / ( 1 + w * sqrt(i^2 + j^2))

where w is a coefficient specified via the -weight option. i and j are measured in pixels. K is zero everywhere beyond the specified kernel width and height โ€” so like, outside the box she simply does not exist. ๐Ÿ’€

the sample values in the PGM output have this value scaled and biased using the protocol pnmconvol specifies for representing the real numbers K in PGM. (yes, that's the whole sentence, no I will not gatekeep it from you โœจ)


๐Ÿ’… OPTIONS ๐Ÿ’…

on top of the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pgmkernel recognizes these command line options, and honestly? she ate with these two. ๐Ÿ”ฅ

  • -weight=number โ€” the distance from the center is weighted by this. a higher number means the value falls off more quickly as you go away from the center. this must be a positive real number. the default is 6.0.
  • -maxval=maxval โ€” the maxval for the PGM kernel. the default is 255. ๐ŸŒˆ this option was new in Netpbm 10.65 (December 2013). before that, the maxval is always 255.
heads up bestie: that -weight has to be positive, okay? no negative numbers allowed anymore โ€” more on that drama in HISTORY below. ๐Ÿšจ

๐Ÿ˜ญ LIMITATIONS ๐Ÿ˜ญ

the computation time is proportional to width*height. this increases rapidly with the increase of the kernel size. a better approach could be using an FFT in these cases. so like, go big if you want but girl will be chugging through it, no cap. ๐Ÿข


๐Ÿ‘‘ HISTORY ๐Ÿ‘‘

  • before Netpbm 10.65 (December 2013), the output was always in Plain (text) PGM format. (now, like standard Netpbm programs, the default is raw PGM and you can get Plain PGM with a -plain option). โœจ
  • before Netpbm 10.65 (December 2013), this manual said negative values for -weight were valid (as long as they were greater than -1.0). but the program never worked with negative numbers and it isn't clear that the result would be useful, so -weight is now required to be nonnegative and the program fails gracefully if you specify a negative value. glow-up era, honestly. ๐Ÿ’…

๐ŸŽ€ SEE ALSO ๐ŸŽ€

pnmconvol(1), pnmsmooth(1) pamgauss(1) pgm(1)


๐Ÿ’œ AUTHOR ๐Ÿ’œ

Alberto Accomazzi (alberto@cfa.harvard.edu). ๐Ÿซถ


๐Ÿ“š DOCUMENT SOURCE ๐Ÿ“š

this manual page was generated by the Netpbm tool makeman from HTML source. the master documentation is at

http://netpbm.sourceforge.net/doc/pgmkernel.html

and that's the whole thing bestie, you understood it fr fr ๐Ÿฆ‹โœจ โ€” this was netpbm documentation, dated 19 December 2013, and it's the Pgmkernel User Manual(1). now go convolve something iconic. bye! ๐Ÿ’–๐ŸŽ€๐ŸŒธ

๐Ÿ“ฆ where this page comes from