1.
size()
获取矩阵的行数或列数
s=size(A)
, 当只有一个输出参数时,返回一个行向量,该行向量的第一个元素时矩阵的行数,第二个元素是矩阵的列数。
[r,c]=size(A),
当有两个输出参数时,
size
函数将矩阵的行数返回到第一个输出变量r,将矩阵的列数返回到第二个输出变量
c
。
2.
C=conv2(A,B)
返回
A,B
卷积得到的矩阵
A=rand(5)
A =
0.7733 0.2961 0.6054 0.4071 0.0318
0.7065 0.3604 0.0829 0.6173 0.8172
0.5596 0.4379 0.4743 0.4797 0.3974
0.0013 0.0400 0.3350 0.3974 0.4252
0.9327 0.8844 0.5378 0.8274 0.5774
B=rand(3)
B =
0.6794 0.6296 0.8829
0.1516 0.4597 0.8582
0.0909 0.2504 0.2984
mesh=conv2(A,B,’valid’)
mesh =
2.2366 1.7291 1.7550
1.3160 1.3673 1.7763
2.1357 2.2233 2.2204
mesh=conv2(A,B,’full’)
mesh =
0.5253 0.6880 1.2804 0.9192 0.8124 0.3795 0.0281
0.5972 1.0900 1.7986 1.3840 1.7286 1.4236 0.7488
0.5576 1.2498 2.2366 1.7291 1.7550 1.7086 1.0617
0.1499 0.5613 1.3160 1.3673 1.7763 1.6018 0.9603
0.6847 1.3747 2.1357 2.2233 2.2204 1.8732 0.9932
0.1415 0.5668 1.3294 1.2637 1.1676 1.2006 0.6224
0.0848 0.3140 0.5487 0.4738 0.4202 0.3915 0.1723
mesh=conv2(A,B,’same’)
mesh =
1.0900 1.7986 1.3840 1.7286 1.4236
1.2498 2.2366 1.7291 1.7550 1.7086
0.5613 1.3160 1.3673 1.7763 1.6018
1.3747 2.1357 2.2233 2.2204 1.8732
0.5668 1.3294 1.2637 1.1676 1.2006
‘full’ — Return the full 2-D convolution.
‘same’ — Return the central part of the convolution, which is the same size as A.
‘valid’ — Return only parts of the convolution that are computed without zero-padded edges.
3. J=edgetaper(I,PSF) 使用点扩散函数矩阵 PSF 对输入图像I的边缘进行模糊处理。 PSF 的大小不得超过图像任意维大小的一半.
4.
A=rand(3)
A =
0.9355 0.4629 0.8031
0.3359 0.5980 0.1569
0.8194 0.7714 0.6698
B = padarray(A,[2 2],’replicate’,’both’)
B =
0.9355 0.9355 0.9355 0.4629 0.8031 0.8031 0.8031
0.9355 0.9355 0.9355 0.4629 0.8031 0.8031 0.8031
0.9355 0.9355 0.9355 0.4629 0.8031 0.8031 0.8031
0.3359 0.3359 0.3359 0.5980 0.1569 0.1569 0.1569
0.8194 0.8194 0.8194 0.7714 0.6698 0.6698 0.6698
0.8194 0.8194 0.8194 0.7714 0.6698 0.6698 0.6698
0.8194 0.8194 0.8194 0.7714 0.6698 0.6698 0.6698
‘both’:Pads before the first element and after the last array element along each dimension. This is the default.
‘post’:Pad after the last array element along each dimension.
‘pre’:Pad before the first array element along each dimension.
‘circular’:Pad with circular repetition of elements within the dimension.
‘replicate’:Pad by repeating border elements of array.
‘symmetric’:Pad array with mirror reflections of itself.