Arithmetic and Logic

Code Snippets

Reasons you may use arithmetic and logic are:

  • to emphasize differences between images by subtracting the pixels (a conformity check).
  • to compensate for non-uniform lighting by dividing the target image by the image of the background alone.
  • to remove unwanted areas of an image by preparing an appropriate mask, and clearing all the pixels that belong to the mask by using logical combinations of pixels.
  • to create a combined image by combining the pixels of two source images to generate a resulting image.

Arithmetic operations are handled by the Oper function, EArithmeticLogicOperation enum lists all supported operators.

These operations can be applied to images and constants, they have one or two source arguments (image or integer constants) and one destination argument. If the source operands are a color and a gray-level image, each color component combines with the gray-level component to give a color image. Histogram equalization can improve your results.