Sum of absolute differences
The sum of absolute differences ( SAD abbreviation, of Engl. Sum of absolute differences) is a positive number that is created by taking the difference of two digital images. It serves as a measure of the difference between two images and finds application in the image processing and recognition section.
The SAD is obtained by the color values of the images are summed pixel by pixel subtracted from each other and amount wise.
Mathematical Foundations
A picture is a picture of a two-dimensional set of definitions in a range of values . The definition correspond to the amount of all the image points of the image and is therefore given by where b is the width and h is the height of the image in pixels. The range of values corresponds to the color space of the image and is 7-bit color depth given by for an ordinary gray value model; If it is a color image, the range of values is usually in three dimensions.
Where two images of the same size and the sum of the absolute differences defined by:
Where b is the width and h is the height of the images respectively.
The sum of the absolute difference is a positive semi-definite, thus always.
Implementation in computer science (monochrome images )
A digital image is represented in the computer science in general by the following data type:
Type picture { int width; int height; int pixels [0 (width -1). ] [0 ( height -1). ]; } The algorithm is implemented for two images of the same size by the following pseudocode:
Long berechneSAD ( see Figure 1, Figure B2) { long SAD = 0; For x = 0 to B1.Breite - 1 do For y = 0 to B1.Hoehe - 1 do SAD SAD = abs ( B2.Pixel [ x] [ y] - B1.Pixel [ x] [ y] ) } The algorithm refers to a complex of, where n is the number of pixels.
- Moving