Add

Image addition.

 

function call:   

[out_img1]=vsg('Add',in_img1,in_img2);

 

Arguments:

in_img1 input image, 3 channel RGB, 1 channel greyscale or binary image, or DICOM image.

in_img2 input image, 3 channel RGB, 1 channel greyscale or binary image, or DICOM image.

 

Description

[out_img1]=vsg('Add',in_img1,in_img2) adds each element in image in_img1 with the corresponding element in image in_img2 and returns the sum in the corresponding element of the output image out_img1. The output - out_img1 has dimensions that are the minimum size to fit both of the input images. Each of the input images are zero padded if their dimensions do not match. The output image is the normalised sum of the greyscale values of the input.

 

Example:

img1 = openimage('baboon.jpg');

img2 = openimage('A.jpg');

[out_img1]=vsg('Add',img1,img2);

figure, image(uint8(out_img1));

 

Notes:

For a single plane greyscale image being added to a 3-plane RGB image, the greyscale image will be added to the red channel of the RGB image because it gets zero-padded along the colour plane axis (i.e. zero padded with a G-plane and B-plane =0).
Home       Functions       Back