⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arithmetic.m

📁 matlab关于对图像进行卷积等操作的一段程序
💻 M
字号:
%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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -