您的位置:首页 > 编程语言 > MATLAB

一分钟了解“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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: