|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
function s=subim(f,4,4,2,2)
0 V0 \1 r8 `- d; C0 n, o%SUBIM Extracts a subimage,s,from a given image,f.
) W- ?4 U/ }6 F3 K%The subimage is of size m-by-n,and the coordinates
( `% v. ?5 J; o- F) s6 k%of its top,left corner are(rx,cy).* ~1 J6 G' w$ d* U! }/ P u
s=zeros(m,n);
& l* A0 e( r& x3 l$ Yrowhigh=rx+m-1;
7 r5 F+ r1 y# g2 X/ |. @ o5 R% jcolhigh=cy+n-1;# I, O! a) P2 w2 I# Y& e/ y0 p
xcount=0;( e/ S& P$ Z7 K0 z8 a5 U# Z
for r=rx:rowhigh( H. V. A) p l/ Q
xcount=xcount+1;& A9 o3 w) q6 C
ycount=0;
* Q7 t3 U/ T6 }for c=cy:colhigh
7 A0 g" g( y; Z. Tycount=ycount+1;5 D H. @* `, p: ]- l* Z
s(xcount,ycount)=f(r,c);
, N0 a3 y |+ rend
& v$ `$ k% T2 z$ o4 w% Gend
& k" W5 f4 T3 T$ g2 n% l N |
|