一分钟了解“Matlab把矩阵边缘上的像素设置为特定值”
2017-06-23 09:51
323 查看
function [ resultMatrix ] = setEdge( matrix,edgeWidth,edgeValue )
%SETEDGE 输入一个矩阵matrix,然后矩阵最边上的edgeWidth层元素用edgeValue填充
% Detailed explanation goes here
matrix(1:edgeWidth,:)=edgeValue;
matrix(size(matrix,1)-edgeWidth+1:size(matrix,1),:)=edgeValue;
matrix(:,1:edgeWidth)=edgeValue;
matrix(:,size(matrix,2)-edgeWidth+1:size(matrix,2))=edgeValue;
resultMatrix=matrix;
end
%SETEDGE 输入一个矩阵matrix,然后矩阵最边上的edgeWidth层元素用edgeValue填充
% Detailed explanation goes here
matrix(1:edgeWidth,:)=edgeValue;
matrix(size(matrix,1)-edgeWidth+1:size(matrix,1),:)=edgeValue;
matrix(:,1:edgeWidth)=edgeValue;
matrix(:,size(matrix,2)-edgeWidth+1:size(matrix,2))=edgeValue;
resultMatrix=matrix;
end
相关文章推荐
- 一分钟了解“Matlab抹去图像边界的无效像素”
- 一分钟了解“Matlab矩阵 [~,a,b,c]的~是什么意思”
- 一分钟了解“Matlab直接求矩阵所有元素的平均值mean2”
- 一分钟了解“matlab把矩阵串联的cat函数”
- 一分钟了解“Matlab把矩阵中的负数变成零”
- 一分钟了解“matlab把一个矩阵矩阵范围拉伸到minVal~maxVal的范围内”
- 一分钟了解“Matlab求两个矩阵的相关程度corr2”
- 一分钟了解“Matlab直接求矩阵所有元素的标准差std2”
- 一分钟了解“matlab用矩阵写法代替for循环”
- 一分钟了解“Matlab提取出矩阵中大于某值的元素”
- 一分钟了解“MATLAB对图像任意mask滤波”
- [Matlab]基础教程学习笔记(一):基础和设置和矩阵教程
- 一分钟了解“MATLAB对图像进行均值滤波”
- 一分钟了解“matlab中访问当前路径和上一个路径”
- 一分钟了解“Matlab统计数值频率和个数tabulate”
- 一分钟了解“Matlab实现max-mean滤波”
- 一分钟了解“Matlab实现tophat变换”
- 一分钟了解“matlab的警告语句warning”
- 一分钟了解“Matlab的squeeze函数”
- 一分钟了解“如何用Matlab求图像梯度”