Image Processing Toolbox    
imlincomb

Compute linear combination of images

Syntax

Description

Z = imlincomb(K1,A1,K2,A2,...,Kn,An) computes:

where K1, K2, through Kn are real, double scalars and A1, A2, through An are real, nonsparse, numeric arrays with the same class and size. Z has the same class and size as A1.

Z = imlincomb(K1,A1,K2,A2,...,Kn,An,K) computes:

where imlincomb adds K, a real, double scalar, to the sum of the products of K1 through Kn and A1 through An.

Z = imlincomb(...,output_class) lets you specify the class of Z. output_class is a string containing the name of a numeric class.

Example

Scale an image by a factor of two.

Form a difference image with the zero value shifted to 128.

To illustrate how imlincomb performs all the arithmetic operations before truncating the result, compare the results of calculating the average of two arrays, X and Y, using nested arithmetic functions and then using imlincomb.

Consider the values in row 1, column 1: 255 in the X and 50 in Y. In the version that uses nested arithmetic functions, imadd adds 255 and 50 and truncates the result to 255 before passing it to imdivide. The average returned in Z(1,1) is 128.

imlincomb performs the addition and division in double precision and only truncates the final result. The average returned in Z2(1,1) is 153.

Form a difference image with the zero value shifted to 128.

See Also

imadd, imcomplement, imdivide, immultiply, imsubtract


  imimposemin immovie