Code covered by the BSD License

# Convolution, Correlation and Arithmetic Operations on Images

17 Jan 2007

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=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');
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
```