# MATLAB CVIP Toolbox Functions ## Arithmetic and Logic Functions

Functions for the application of arithmetic and logic operations to images are contained in this category. These functions require one or two images as input and they all return an image. Related functions, specifically multiplication functions that perform gray-level mapping, are in the histogram category. Included here are arithmetic functions to add, subtract, multiply, divide as well as logic functions AND, OR, XOR and NOT. The arithmetic functions will convert any image data to double precision floating point data before performing the operation, and return double precision floating point data. The logic functions will convert any input images to 8-bit or 16-bit unsigned integer data, by linear remapping if necessary, before the operation is performed. They will then perform the logic operation and return an image of type 8-bit or 16-bit unsigned integer. If the images are of different size the upper left corner will be aligned at the (1,1) location (note: this corresponds to the (0,0) location in the C programming language) and the smaller image will be zero padded before the operation is performed. If the images have a different number of bands, the single band image will have that band repeated to perform the operation.

• add_cvip - add two images, or add a constant to an image
• and_cvip - perform a logical AND on two images
• divide_cvip - divide one image by another, or divide an image by a constant
• multiply_cvip - multiply two images, or multiply an image by a constant
• not_cvip - perform a logical NOT on an image
• or_cvip - perform a logical OR on two images
• subtract_cvip - subtract one image from another, or subtract a constant from an image
• xor_cvip - perform a logical XOR on two images