关于matlab的问题,在线等,急求!clearclc;A=imread('finger.tif');subplot(121),imshow(A);[m,n]=size(A);Sum=sum(sum(A));%求和T0=Sum/(m*n);%初始阈值T0=round(T0);%取整a=zeros(m,n);T=0;while(T0~=T) sum1=0; sum2=0; count1=0; count
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/22 16:13:38
关于matlab的问题,在线等,急求!clearclc;A=imread('finger.tif');subplot(121),imshow(A);[m,n]=size(A);Sum=sum(sum(A));%求和T0=Sum/(m*n);%初始阈值T0=round(T0);%取整a=zeros(m,n);T=0;while(T0~=T) sum1=0; sum2=0; count1=0; count
关于matlab的问题,在线等,急求!
clear
clc;
A=imread('finger.tif');
subplot(121),imshow(A);
[m,n]=size(A);
Sum=sum(sum(A));%求和
T0=Sum/(m*n);%初始阈值
T0=round(T0);%取整
a=zeros(m,n);
T=0;
while(T0~=T)
sum1=0;
sum2=0;
count1=0;
count2=0;
for i=1:m
for j=1:n
if a(i,j) < T0;
len1=length(find(A==a(i,j)));
sum1=sum1+a(i,j)*len1;
count1=count1+len1;
else
len2=length(find(A==a(i,j)));
sum2=sum2+a(i,j)*len2;
count2=count2+len2;
end
end
end
m1=sum1/count1;
m2=sum2/count2;
T=(m1+m2)/2;
T=round(T);
T0=T;
end
subplot(122),imshow(A>T);
一直死循环,出不来,但不知道是什么问题.
关于matlab的问题,在线等,急求!clearclc;A=imread('finger.tif');subplot(121),imshow(A);[m,n]=size(A);Sum=sum(sum(A));%求和T0=Sum/(m*n);%初始阈值T0=round(T0);%取整a=zeros(m,n);T=0;while(T0~=T) sum1=0; sum2=0; count1=0; count
while(T0~=T)
...
T0=T;
end
你这里死循环了,当然出不来呀