|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
function s=subim(f,4,4,2,2)
0 `: a6 h, r1 k1 u/ c%SUBIM Extracts a subimage,s,from a given image,f.
: d0 S- p Q; G3 }$ h- h%The subimage is of size m-by-n,and the coordinates
$ S! d# E, b s( E) L; p%of its top,left corner are(rx,cy).
6 d* L! \7 s m/ T+ `8 V, gs=zeros(m,n);
8 O& X3 L6 @! nrowhigh=rx+m-1;7 i8 p4 B0 @9 k
colhigh=cy+n-1;* u4 F$ M4 v2 _1 Z ~; e
xcount=0;+ ~* L# f: m/ ~
for r=rx:rowhigh: o% f2 N9 ]6 j* l5 z2 c; A3 ]$ h
xcount=xcount+1;
; y5 M) ^' P6 \5 T) `ycount=0;" W7 D; `6 n. T4 f6 _
for c=cy:colhigh4 {) g. R4 j! q" z* q
ycount=ycount+1;! J. J, }/ Z1 d' d0 r* q
s(xcount,ycount)=f(r,c);
$ j* s' f* c! Z- M9 |) {9 Dend+ L; ]; S% c4 W. O) o) t
end
& {. D- @/ m4 H& M0 ~; ?$ w+ U |
|