|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
function s=subim(f,4,4,2,2)- D" c4 O. V* i& I
%SUBIM Extracts a subimage,s,from a given image,f.
, O2 ]/ g/ W8 j+ f: m9 k%The subimage is of size m-by-n,and the coordinates
1 \0 ^; J# r3 o( v" w& b. \ P%of its top,left corner are(rx,cy).. j, D8 j& m4 j5 d# n& \
s=zeros(m,n);
# r- Y1 u! i7 N9 Z) u8 V$ urowhigh=rx+m-1;& q2 Z! Z4 I! b/ x' w2 l6 Q
colhigh=cy+n-1;
3 L6 J+ y, v: G, bxcount=0;
# W1 [* C' @' D: {0 u2 H# \for r=rx:rowhigh5 [* H+ n9 a, d7 H; Q. X5 t
xcount=xcount+1;% K8 s2 a- B' o* ]) j7 a9 u
ycount=0;
, s4 x, ~, Z9 q6 w5 zfor c=cy:colhigh
% W5 r6 s" v$ u( uycount=ycount+1;
( Z( M" Z* i) k% Qs(xcount,ycount)=f(r,c);
' ~" m5 X* s" q4 y# Uend
9 {- t9 ]7 J. v, x c4 yend6 ?! g8 P5 M3 c% u. H' `% o( r$ U
|
|