Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2009-04-18
年龄: 36
帖子: 2
声望力: 0 ![]() |
![]()
format long
P=imread('picture.bmp'); lefttop=[100 240 142 244 170 258 450 545 471 543]; rightbutton=[200 368 375 466 591 685 200 330 537 624]; for circle=1:5 circle if(circle~=1) clear u; clear v; end k=1; for i=lefttop(circle,1):lefttop(circle,2); flag=0; for j=rightbutton(circle,1):rightbutton(circle,2); if flag==0 & P(i,j)<10 u(k)=i; v(k)=j; k=k+1; flag=1; elseif flag==1 & P(i,j)<10 & P(i,j+1)>200 u(k)=i; v(k)=j; k=k+1; end end end for j=rightbutton(circle,1):rightbutton(circle,2) flag=0; for i=lefttop(circle,1):lefttop(circle,2) if flag==0 & P(i,j)<10 f1=0; for temp=1:k-1 if u(temp)==i & v(temp)==j f1=1; end end if f1==0 u(k)=i; v(k)=j; k=k+1; flag=1; end elseif flag==1 & P(i,j)<10 & P(i+1,j)>200 f1=0; for temp=1:k-1 if u(temp)==i & v(temp)==j f1=1; end end if f1==0 u(k)=i; v(k)=j; k=k+1; flag=1; end end end end axis equal; axis([1 768 1 1024]); plot(u,v,'.');grid on ;hold on; x=ones(k-1,5); y=ones(k-1,1); for i=1:k-1 x(i, ![]() y(i)=-u(i)*u(i); end [b,bint,r,rint,stats]=regress(y,x); b bint stats A=[2 b(4); b(4) 2*b(5)]; B=[-b(3);-b(2)]; X=A\B xo=(X(2)-512)/3.78 yo=(384-X(1))/3.78 xlswrite(strcat('d:/',num2str(circle),'.xls'),[u;v]'); end |
![]() |
![]() |
![]() |
#2 |
高级会员
注册日期: 2008-11-01
年龄: 39
帖子: 406
声望力: 26 ![]() |
![]()
lz 能否说明具体的问题和不清楚的地方
大家一起讨论一下 |
![]() |
![]() |
![]() |
#3 |
初级会员
注册日期: 2009-04-18
年龄: 36
帖子: 2
声望力: 0 ![]() |
![]()
for j=rightbutton(circle,1):rightbutton(circle,2)
flag=0; for i=lefttop(circle,1):lefttop(circle,2) if flag==0 & P(i,j)<10 f1=0; for temp=1:k-1 if u(temp)==i & v(temp)==j f1=1; end end if f1==0 u(k)=i; v(k)=j; k=k+1; flag=1; end 里面的temp是干什么用的 而且f1的作用是什么呢? |
![]() |
![]() |
![]() |
#4 |
高级会员
注册日期: 2008-11-01
年龄: 39
帖子: 406
声望力: 26 ![]() |
![]()
lz 能否把'picture.bmp'传上来
我印证一下自己读程理解的是否正确 谢谢了 |
![]() |
![]() |