Logical NOT or invert is an operator which takes a binary or graylevel image as input and produces its photographic negative, i.e. dark areas in the input image become light and light areas become dark.
To produce the photographic negative of a binary image we can employ the logical NOT operator. Its truth-table is shown in Figure 1.
Figure 1 Truth-table for logical NOT.
Each pixel in the input image having a logical 1 (often referred to as foreground) has a logical 0 (associated with the background in the output image and vice versa. Hence, applying logical NOT to a binary image changes its polarity.
The logical NOT can also be used for a graylevel image being stored in byte pixel format by applying it in a bitwise fashion. The resulting value for each pixel is the input value subtracted from 255:
Some applications of invert also support integer or float pixel format. In this case, we can't use the logical NOT operator, therefore the pixel values of the inverted image are simply given by
If this output image is normalized for an 8-bit display, we again obtain the photographic negative of the original input image.
the resulting image,
shows the union of the background, because it is represented with a logical 1. However, if we OR
which are the inverted versions of the above image we obtain
Now, the result contains the union of the two circles.
We illustrate another example of the importance of the polarity of a binary image using the dilation operator. Dilation expands all white areas in a binary image. Hence, if we dilate
the object, being represented with a logical 1, grows and the holes in the object shrink. We obtain
If we dilate
which was obtained by applying logical NOT to the original image, we get
Here, the background is expanded and the object became smaller.
Invert can be used for the same purpose on grayscale images, if they are processed with a morphological or logical operator.
Invert is also used to print the photographic negative of an image or to make the features in an image appear clearer to a human observer. This can, for example, be useful for medical images, where the objects often appear in black on a white background. Inverting the image makes the objects appear in white on a dark background, which is often more suitable for the human eye. From the original image
of a tissue slice, we obtain the photographic negative
You can interactively experiment with this operator by clicking here.
Which polarity of the image allows you to suppress the circles?
and ORing their photographic negatives.
Does it improve the visibility of the features in the image?
A. Jain Fundamentals of Digital Image Processing, Prentice Hall, 1989, p 238.
R. Gonzales and R. Woods Digital Image Processing, Addison Wesley, 1992, pp 47 - 51.
E. Davies Machine Vision: Theory, Algorithms and Practicalities, Academic Press, 1990, Chap. 2.
Specific information about this operator may be found here.
More general advice about the local HIPR installation is available in the Local Information introductory section.
©2003 R. Fisher, S. Perkins,
A. Walker and E. Wolfart.