|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
function s=subim(f,4,4,2,2)
- p- p7 g+ p/ u%SUBIM Extracts a subimage,s,from a given image,f.
: g) K/ P! g3 E- v%The subimage is of size m-by-n,and the coordinates
& I, l5 W# y: P, y c%of its top,left corner are(rx,cy).: A6 }" i$ d( T0 k1 _6 t1 R
s=zeros(m,n);
3 d/ F- c3 j# v4 c+ F+ prowhigh=rx+m-1;+ X9 i9 l, g& ?" r7 Y7 ^
colhigh=cy+n-1;
/ a Q/ Q' o; b/ H2 i s& O: ^xcount=0;
# M9 T7 i$ @ P7 q1 Xfor r=rx:rowhigh
% b" V( \3 ~1 I/ N) x \. ` Xxcount=xcount+1;! w: t8 l: e! t x/ M# d
ycount=0;
( U0 ?. }3 F; p$ l- D+ Vfor c=cy:colhigh
- L: `, _ J D* e- s* C! L4 m4 h) yycount=ycount+1;
- H( X* J$ c4 f2 ~6 v9 _9 k( [s(xcount,ycount)=f(r,c);: w5 B& B/ `% K' C$ a
end7 x) z, t7 W8 B( G: R6 J
end
$ G$ ]7 ?/ u4 g! C9 p+ A |
|