Logical AND/NAND Brief Description AND and NAND are examples of logical operators having the truth-tables shown in Figure 1. Figure 1 Truth-tables for AND and NAND. As can be seen, the output values of NAND are simply the inverse of the corresponding output values of AND. The AND (and similarly the NAND) operator typically takes two binary or integer graylevel images as input, and outputs a third image whose pixel values are just those of the first image, ANDed with the corresponding pixels from the second. A variation of this operator takes just a single input image and ANDs each pixel with a specified constant value in order to produce the output. How It Works The operation is performed straightforwardly in a single pass. It is important that all the input pixel values being operated on have the same number of bits in them or unexpected things may happen. Where the pixel values in the input images are not simple 1-bit numbers, the AND operation is normally (but not always) carried out individually on each corresponding bit in the pixel values, in bitwise fashion . Guidelines for Use The most obvious application of AND is to compute the intersection of two images. We illustrate this with an example where we want to detect those objects in a scene which did not move between two images, i.e. which are at the same pixel positions in the first and the second image. We illustrate this example using and If we simply AND