The only requirement for superimposition (or addition) of two images is that the two matrices that you have defined for two images should have the same size (as we know MATLAB totally works with matrices and the addition of two matrices is possible only when they are of the same size).
Let us consider two images
- H: New photorock 1.jpg
- H: New photoImagesPhoto1561.jpg
(These are two images that I have chosen, but for your case, it may be different. For copying the image path visit my previous post)
MATLAB Program for Addition of Two Images:
%Addition of two images
%Created by : myclassbook.org (mayuresh)
%Created on : 21 May 2013
A=imread('H:New photorock 1.jpg'); %define A as a first image
B=imread('H:New photoImagesPhoto1561.jpg'); %define B as a second image
C=imresize(A,[400 400]); % image resize of A as 400*400 matrix
D=imresize(B,[400 400]); % image resize of B as 400*400 matrix
E=imadd(C,D); % image addtion of C and D
imshow(E) % display of image E
Output
If you like this article, please share it with your friends and like or facebook page for future updates. Subscribe to our newsletter to get notifications about our updates via email. If you have any queries, feel free to ask in the comments section below. Have a nice day!