Name

bwdiff — compare two black and white files

Synopsis

bwdiff [ - [mglen]] [-b ] file1 file2

DESCRIPTION

bwdiff compares two black and white bw(5) format files in one of several ways, and writes the results on standard out. The default method of comparison is to record the differences as offsets from neutral, half-intensity grey (128). The value written will be brighter than this neutral grey by an amount proportional to the signed difference between the pixels in file1 and file2. That is, pixels which are brighter in file1 than in file2 will be brighter than the neutral grey, while pixels which are dimmer in file1 than in file2 will be dimmer. This difference is divided by two so that the results will fit in the 0->255 output range.

The -m flag takes the magnitude of the difference, thus no offset or divide is necessary. Brighter pixels indicate larger differences in value. Black indicates no difference in value.

The flags -g -l -e and -n are relational operations, standing for greater-than, less-than, equal-to, and not-equal-to respectively. Only one of these flags may be used at a time. In this mode the value of a pixel in the first file is compared to the corresponding pixel in the second, and if the relation is true, a full-white (255) pixel is output. This mode is useful for producing masks showing pixels which satisfy the given condition. The default background is black, unless the -b option is specified, is which case the background is file1, with a lowered intensity.

bwdiff accepts ``-'' as a synonym for stdin, and ``.'' as a synonym for /dev/null .

Note that this program also produces useful results on color pix(5) files.

EXAMPLE

Suppose you ran pixstat(1) on a file and found the modes to be red=107, green=93, blue=70. You could display those pixels whose colors are at these values by:

gencolor 107 93 70 | bwdiff -e file.pix - | pix-fb

SEE ALSO

brlcad(1), pixdiff(1), bwstat(1), bw(5), pix(5)

AUTHOR

BRL-CAD Team

COPYRIGHT

This software is Copyright (c) 1989-2020 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