|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
function s=subim(f,4,4,2,2)
5 X9 b" s4 f9 w/ K%SUBIM Extracts a subimage,s,from a given image,f.: @& o8 p+ ~7 {% s. _
%The subimage is of size m-by-n,and the coordinates
6 o+ j: M4 x: Y8 V8 x. I%of its top,left corner are(rx,cy).0 w! A7 U4 ]2 [* L0 X# |
s=zeros(m,n);6 N4 c1 Q3 T: J8 k3 s. p X
rowhigh=rx+m-1;
1 U( \4 I2 b% {colhigh=cy+n-1;
! K- n$ Y/ t! Y9 D3 yxcount=0;' G4 x4 \/ A+ F; m
for r=rx:rowhigh+ ?( D" @- V M8 m8 i
xcount=xcount+1;3 H: Y P, l, X
ycount=0;& K. n* x7 T8 O2 I2 b) d
for c=cy:colhigh
! q( |4 Q7 E* [: A. r/ ^# mycount=ycount+1;: X8 q% P9 m4 z; o) o% s* e
s(xcount,ycount)=f(r,c);" b" u$ X' a' d# ?5 M
end
8 V$ o$ ~6 Q$ E: o0 V. l* S9 Uend
7 }( }% G, x3 q7 p! I1 `1 O |
|