<< Image operations | Image operations | addWeighted >>

scicv >> Image operations > add

# add

Add two images

### Syntax

    img = add(img1, img2[, mask[, dtype]])

### Parameters

img1

  Image (Mat).

img2

  Image (Mat).

mask

  Optional mask image (Mat).

dtype

  Optional depth of the output image.

img

  Output image (Mat).

### Description

`add` computes the sum of two images pixel per pixel.

### Examples

    scicv_Init();

    img1 = imread(getSampleImage("lena.jpg"));
    img2 = new_Mat(size(img1, 'c'), size(img1, 'r'), CV_8UC3, 40);

    img_out = add(img1, img2);
    matplot(img_out);

    delete_Mat(img1);
    delete_Mat(img2);
    delete_Mat(img_out);

### See also

- sub

Report an issue
<< Image operations | Image operations | addWeighted >>