from Convolution, Correlation and Arithmetic Operations on Images by Madhu S. Nair
Convolution, Correlation and Arithmetic Operations such as Addition, Subtraction, Multiplication and

arithmetic(x,y)
%Question No:1

%Write a MATLAB function which performs the four arithmetic operations
%between two images.

function arithmetic(x,y)
a=imread(x);
b=imread(y);
a=im2double(a);
b=im2double(b);
choice=input('1: Addition \n2: Subtraction \n3: Multiplication \n4: Division \n Enter the choice : ');
switch choice
    case 1
        c=a+b;
        subplot(1,3,1),imshow(a),title('Image 1');
        subplot(1,3,2),imshow(b),title('Image 2');
        subplot(1,3,3),imshow(c),title('Image After Addition');
    case 2
        c=a-b;
        subplot(1,3,1),imshow(a),title('Image 1');
        subplot(1,3,2),imshow(b),title('Image 2');
        subplot(1,3,3),imshow(c),title('Image After Subtraction');
    case 3
        c=a.*b;
        subplot(1,3,1),imshow(a),title('Image 1');
        subplot(1,3,2),imshow(b),title('Image 2');
        subplot(1,3,3),imshow(c),title('Image After Multiplication');
    case 4
        c=a./b;
        subplot(1,3,1),imshow(a),title('Image 1');
        subplot(1,3,2),imshow(b),title('Image 2');
        subplot(1,3,3),imshow(c),title('Image After Division');
    otherwise 
        error('Wrong Choice');
end
end

Contact us