Linear combination of images imlincomb

imlincomb multiplies every element with specified scale.
Z = imlincomb(K1,A1,K2,A2,…,Kn,An)

K1*A1 + K2*A2 + … + Kn*An

Example

>> A = [1 2 3; 4 5 6]

A =

     1     2     3
     4     5     6

>> B = [9 3 12; 5 7 3]

B =

     9     3    12
     5     7     3

>> imlincomb(3,A)

ans =

     3     6     9
    12    15    18

Now if there are N number of elements then the output will be produced as same as matrix addition. as :

Example

>> A = [1 2 3; 4 5 6]

A =

     1     2     3
     4     5     6

>> B = [9 3 12; 5 7 3]

B =

     9     3    12
     5     7     3

>> imlincomb(3,A,2,B) % multiply 3 with A and 2 with b for every element

ans =

    21    12    33
    22    29    24

Same can be done with images as :

Example

>> i = imread('Desert.jpg');
>> imshow(i);
>> j= imlincomb(2,i);
>> imshow(j);

Output