diff options
Diffstat (limited to 'genFeatureVec.m')
-rw-r--r-- | genFeatureVec.m | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/genFeatureVec.m b/genFeatureVec.m index 75fa0e8..4ac8ec8 100644 --- a/genFeatureVec.m +++ b/genFeatureVec.m @@ -1,6 +1,7 @@ function vec = genFeatureVec(img) bins = 16; ncnls = 8; + secs = 6; cnls = zeros(size(img,1), size(img,2),ncnls); cnls(:,:,1:3) = img; cnls(:,:,4:6) = rgb2ycbcr(img); @@ -35,21 +36,36 @@ function vec = genFeatureVec(img) vec=[]; for i = 1:sc for cnl = 1:ncnls - filt = schmidFilter(scVec(i,1),scVec(i,2)); - pos = real(sum(sum(filt.*(filt>0)))); - neg = real(sum(sum(filt.*(filt<0)))); - ss = (pos-neg)/bins; - v = histcounts(imfilter(cnls(:,:,cnl), filt, 'symmetric'),(0:bins)*ss+neg); - vec=cat(2,vec,v); + for sec = 1:secs + filt = schmidFilter(scVec(i,1),scVec(i,2)); + pos = real(sum(sum(filt.*(filt>0)))); + neg = real(sum(sum(filt.*(filt<0)))); + ss = (pos-neg)/bins; + section = getSection(cnls(:,:,cnl),sec,secs); + v = histcounts(imfilter(section, filt, 'symmetric'),(0:bins)*ss+neg); + vec=cat(2,vec,v); + end end end for i = 1:gb for cnl = 1:ncnls - filt = gaborFilter(gbVec(i,1),gbVec(i,2),gbVec(i,3),gbVec(i,4)); - pos = real(sum(sum(filt.*(filt>0)))); - neg = real(sum(sum(filt.*(filt<0)))); - ss = (pos-neg)/bins; - v = histcounts(real(imfilter(cnls(:,:,cnl), filt, 'symmetric')),(0:bins)*ss+neg); - vec=cat(2,vec,v); + for sec = 1:secs + filt = gaborFilter(gbVec(i,1),gbVec(i,2),gbVec(i,3),gbVec(i,4)); + pos = real(sum(sum(filt.*(filt>0)))); + neg = real(sum(sum(filt.*(filt<0)))); + ss = (pos-neg)/bins; + section = getSection(cnls(:,:,cnl),sec,secs); + v = histcounts(real(imfilter(section, filt, 'symmetric')),(0:bins)*ss+neg); + vec=cat(2,vec,v); + end end - end
\ No newline at end of file + end +end + +function [sec] = getSection(inp,a,b) + [m,n] = size(inp); + ste = (m-1)/b; + st=1+ceil(ste*(a-1)); + ed=1+floor(ste*a); + sec = inp(st:ed,:); +end
\ No newline at end of file |