MATLAB 图像算法问题 Too many input arguments.g1是一副二值图像:[N1,N2]=size(g1);for i=2:N1for j=2:N2-1g1(i,j)=min(g1(i-1,j-1)+4,g1(i-1,j)+3,g1(i-1,j+1)+4,g1(i,j-1)+3,g1(i,j))endend运行后会报错:Error using ==> minToo many input a

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/30 09:27:39
MATLAB 图像算法问题 Too many input arguments.g1是一副二值图像:[N1,N2]=size(g1);for i=2:N1for j=2:N2-1g1(i,j)=min(g1(i-1,j-1)+4,g1(i-1,j)+3,g1(i-1,j+1)+4,g1(i,j-1)+3,g1(i,j))endend运行后会报错:Error using ==> minToo many input a
xN@_e4IA7ڒhNY3.0bS )/A%V-%F11 ̜| 0l?sdvHN;j箄B8-$ɉ& +b*7S"GJ5l!WÍ'r.2BL]vبcl?cA8*/fN_`pM;'OnJJ!Vk7;&3po  #5.N3Jf;a? u9!ỳ~._QޛQj6'gJ :6*Tok;2mL,nXc- mԠ]ԌPB~-l4&3~C<3{Oȥ

MATLAB 图像算法问题 Too many input arguments.g1是一副二值图像:[N1,N2]=size(g1);for i=2:N1for j=2:N2-1g1(i,j)=min(g1(i-1,j-1)+4,g1(i-1,j)+3,g1(i-1,j+1)+4,g1(i,j-1)+3,g1(i,j))endend运行后会报错:Error using ==> minToo many input a
MATLAB 图像算法问题 Too many input arguments.
g1是一副二值图像:
[N1,N2]=size(g1);
for i=2:N1
for j=2:N2-1
g1(i,j)=min(g1(i-1,j-1)+4,g1(i-1,j)+3,g1(i-1,j+1)+4,g1(i,j-1)+3,g1(i,j))
end
end
运行后会报错:
Error using ==> min
Too many input arguments.
小弟MATLAB新手求大神帮助

MATLAB 图像算法问题 Too many input arguments.g1是一副二值图像:[N1,N2]=size(g1);for i=2:N1for j=2:N2-1g1(i,j)=min(g1(i-1,j-1)+4,g1(i-1,j)+3,g1(i-1,j+1)+4,g1(i,j-1)+3,g1(i,j))endend运行后会报错:Error using ==> minToo many input a
min函数只能同时求两个数的最小值,你输入了5个值,肯定提示输入参数太多了,可以改为:
g1(i,j)=min(g1(i-1,j-1)+4,min(g1(i-1,j)+3,min(g1(i-1,j+1)+4,min(g1(i,j-1)+3,g1(i,j)))));