bwfilter [-v] [-f _type_] [-d _div_] [-O _offset_] [-s _squaresize_] [-w _width_] [-n _height_] [-o _out_file.bw_] [_file.bw_]
BWFILTER(1)
NAME
bwfilter - apply a 3x3 kernel filter to a black and white bw image
On this page
SYNOPSIS
DESCRIPTION
bwfilter convolves a 3x3 kernel filter over a black and white bw(5) format image. It reads from file.bw or from standard input when no file is given, and writes the filtered result to standard output (or to the file named with -o). The outer rows and columns of the image are left untouched.
By default the input is assumed to be 512x512 pixels and a low pass filter is applied. Each built-in filter has an associated divisor that scales the convolved result back into the 0-255 range and, for some filters, an offset that recenters the result; both may be overridden.
OPTIONS
- -f type
-
Select the filter to apply (default lo). Recognized types are:
- lo
-
low pass
- hi
-
high pass
- vg
-
vertical gradient
- hg
-
horizontal gradient
- la
-
laplacian
- b
-
boxcar average (low pass)
- -d div
-
Override the kernel divisor. Most filters divide the result of the kernel multiplication by a fixed value to scale it into a 0-255 range (for example, the boxcar filter divides by nine). A divisor of zero is rejected.
- -O offset
-
Override the kernel offset. Some filters add an offset to their results; the laplacian, for instance, is centered about zero and adds 128 to yield a difference from neutral grey.
- -s squaresize
-
Set both the width and height of the input image to squaresize.
- -w width
-
Set the width of the input image to width (default 512).
- -n height
-
Set the height of the input image to height (default 512).
- -o out_file.bw
-
Write the filtered output to out_file.bw. If standard output is also non-interactive (redirected or piped), the same output is written to both destinations.
- -v
-
Verbose: print the kernel values and the maximum and minimum output values to standard error.
EXAMPLES
bwfilter -f hi -s 1024 image.bw > sharp.bw
Applies a high pass filter to the 1024x1024 image image.bw and redirects the result to sharp.bw, accentuating edges and fine detail.
bwfilter -f la moon.bw | bw-pix | pix-fb
Runs a laplacian edge detector over moon.bw, converts the resulting black and white image to pix(5) with bw-pix(1), and displays it on a framebuffer with pix-fb(1) without writing any intermediate file.
BUGS
This should allow any arbitrary 3x3 kernel to be specified on the command line.
SEE ALSO
brlcad(1), bwmod(1), bwscale(1), pixfilter(1), bw(5)
AUTHOR
BRL-CAD Team
COPYRIGHT
This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.
BUG REPORTS
Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org