|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
function s=subim(f,4,4,2,2)' x+ I V& a! B( r7 {0 a
%SUBIM Extracts a subimage,s,from a given image,f.
- n' `* t. V+ m. D5 D' ^%The subimage is of size m-by-n,and the coordinates
( O4 ^* Y F& `, ~%of its top,left corner are(rx,cy).2 m5 w) D9 |* y0 @$ b9 f
s=zeros(m,n);
& l+ [: l; v \' F+ K: _rowhigh=rx+m-1;
) R' S6 u& K# j+ U" {; Qcolhigh=cy+n-1;
N: Y, @4 M3 M* t9 _- Qxcount=0;
' I" Y- c5 b5 c' Dfor r=rx:rowhigh
4 N- l3 [# t) mxcount=xcount+1;
$ d$ ]- B7 b! S* @ycount=0;
2 ~8 c+ X3 C+ _1 `for c=cy:colhigh
0 @2 R1 O( u ~: L( n+ n6 ~: vycount=ycount+1;
+ T& R: T* W4 t; ss(xcount,ycount)=f(r,c);$ O5 J+ p9 O% J* W
end
6 i7 z9 \0 G" c* V' \1 }! _end
5 q. C) h0 z* ]/ Z, V V7 g |
|