图像的基本运算&代数运算(待)

1.1 图像的叠加函数:imadd函数
例1:将两幅图像叠加在一起

I=imread('people.jpg');
J=imread('dragon.jpg');
K=imadd(I,J,'uint16');%将两幅图像叠加
imshow(I);figure,imshow(J);figure,imshow(K,[])

例2:使用imadd函数调整图像亮度

I=imread('flower.jpg');
J=imadd(I,50);%调亮图像亮度
subplot(1,2,1),imshow(I)
subplot(1,2,2),imshow(J)

1.2 绝对值差函数:imabsdiff函数

x=imread('flower.jpg');
myf=@(x)mean(x);
y=uint8(colfilt(x,[],'sliding',myf));
z=imabsdiff(x,y);
subplot(1,3,2),imshow(x);
subplot(1,3,2),imshow(y);
subplot(1,3,3),imshow(z);

1.3 图像的减法运算:imsubtract函数

X=imread('flower.jpg');
Y=imread('flower.jpg');
Z=imsubtract(X,Y) %将两幅图像进行减法运算
subplot(1,3,1),imshow(X);
subplot(1,3,2),imshow(Y);
subplot(1,3,3),imshow(Z);

1.4 图像的乘法运算:immultiply函数

I=imread('flower.jpg');
I16=uint16(I);
J=immultiply(I16,I16);%将两幅图像相乘
K=immultiply(I,0.5);%将图像亮度增强
imshow(I);figure,imshow(J);figure,imshow(K)

1.5 图像的除法运算:imdivide函数

x=imread('flower.jpg');
myf=@(x)...
   (min (min(x,date)))*uint8(ones(size(x,date)));
y=blockproc(x,[15 15],myf);
z=imdivide(x,y);
imshow(x);figure,imshow(z,[]);figure,imshow(imdivide(x,2));

1.6 图像的线性组合

I=imread('flower.jpg');
J=imread('people.jpg');
K=imlincomb(1,I,3,J,'uint16');%两幅图像的线性组合
imshow(I);figure,imshow(J);figure,imshow(K,[])

1.7 图像的求补运算:imcomplement函数

I=imread('1.jpg');
J=imcomplement(I);%图像的负片
imshow(I);figure,imshow(J)

你可能感兴趣的:(图像的基本运算&代数运算(待))