diff options
author | Joe Zhao <ztuowen@gmail.com> | 2015-06-27 20:09:12 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2015-06-27 20:09:12 +0800 |
commit | ac7a813ca3fa0d7b8ddb61499fa50eca1336101c (patch) | |
tree | df724ba3b9b9c5e4f27726502ef758303ad9b6fa | |
parent | 81d9c2360fd88422fcf7c8bd176f0ae07af2a9bf (diff) | |
download | featext-ac7a813ca3fa0d7b8ddb61499fa50eca1336101c.tar.gz featext-ac7a813ca3fa0d7b8ddb61499fa50eca1336101c.tar.bz2 featext-ac7a813ca3fa0d7b8ddb61499fa50eca1336101c.zip |
upload all
-rw-r--r-- | genFeatureVec.m | 67 | ||||
-rwxr-xr-x | genRid.sh | 2 | ||||
-rw-r--r-- | getFeatureExt.m | 46 | ||||
-rw-r--r-- | getVecs.m | 2 | ||||
-rw-r--r-- | parGetVecs.m | 4 |
5 files changed, 69 insertions, 52 deletions
diff --git a/genFeatureVec.m b/genFeatureVec.m index 0b227fa..d3ee056 100644 --- a/genFeatureVec.m +++ b/genFeatureVec.m @@ -7,9 +7,9 @@ function vec = genFeatureVec(img,minc,maxc) cnls(:,:,4:6) = rgb2ycbcr(img); hsv = rgb2hsv(img); cnls(:,:,7:8) = hsv(:,:,1:2); - for i=1:ncnls - cnls(:,:,i) = histeq(cnls(:,:,i)); - end + %for i=1:ncnls + % cnls(:,:,i) = histeq(cnls(:,:,i)); + %end % Schmid scVec=[ 1,2; @@ -29,41 +29,54 @@ function vec = genFeatureVec(img,minc,maxc) 0.3,0,4,2; 0.3,0,8,2; 0.4,0,4,1; - 0.4,0,8,2; + 0.4,0,8,1; 0.3,pi/2,4,2; 0.3,pi/2,8,2; 0.4,pi/2,4,1; - 0.4,pi/2,8,2;]; + 0.4,pi/2,8,1;]; gb = length(gbVec); sc = length(scVec); vec=[]; nn=1; + % Avg + for cnl = 1:ncnls + for sec = 1:secs + pos = maxc(nn); + neg = minc(nn); + nn=nn+1; + ss = (pos-neg)/bins; + section = getSection(cnls(:,:,cnl),sec,secs); + v = histcounts(section,(0:bins)*ss+neg); + v=v/sum(v); + vec=cat(2,vec,v); + end + end + % Schmid for i = 1:sc - for cnl = 1:ncnls - for sec = 1:secs - filt = schmidFilter(scVec(i,1),scVec(i,2)); - pos = maxc(nn); - neg = minc(nn); - nn=nn+1; - 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 + filt = schmidFilter(scVec(i,1),scVec(i,2)); + for sec = 1:secs + pos = maxc(nn); + neg = minc(nn); + nn=nn+1; + ss = (pos-neg)/bins; + section = getSection(hsv(:,:,3),sec,secs); + v = histcounts(imfilter(section, filt, 'symmetric'),(0:bins)*ss+neg); + v=v/sum(v); + vec=cat(2,vec,v); end end + % Gabor for i = 1:gb - for cnl = 1:ncnls - for sec = 1:secs - filt = gaborFilter(gbVec(i,1),gbVec(i,2),gbVec(i,3),gbVec(i,4)); - pos = maxc(nn); - neg = minc(nn); - nn=nn+1; - 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 + filt = gaborFilter(gbVec(i,1),gbVec(i,2),gbVec(i,3),gbVec(i,4)); + for sec = 1:secs + pos = maxc(nn); + neg = minc(nn); + nn=nn+1; + ss = (pos-neg)/bins; + section = getSection(hsv(:,:,3),sec,secs); + v = histcounts(imfilter(section, filt, 'symmetric'),(0:bins)*ss+neg); + v=v/sum(v); + vec=cat(2,vec,v); end end end @@ -3,7 +3,7 @@ ofile=${1}.rid runMatlab parGetVecs \'${1}\' -echo 16128 > ${ofile} +echo 2784 > ${ofile} cat ${1}_a.txt >> ${ofile} cat ${1}_b.txt >> ${ofile} echo 0 >> ${ofile} diff --git a/getFeatureExt.m b/getFeatureExt.m index 791a7aa..0b55648 100644 --- a/getFeatureExt.m +++ b/getFeatureExt.m @@ -6,9 +6,9 @@ function [ minc,maxc ] = getFeatureExt( img ) cnls(:,:,4:6) = rgb2ycbcr(img); hsv = rgb2hsv(img); cnls(:,:,7:8) = hsv(:,:,1:2); - for i=1:ncnls - cnls(:,:,i) = histeq(cnls(:,:,i)); - end + %for i=1:ncnls + % cnls(:,:,i) = histeq(cnls(:,:,i)); + %end % Schmid scVec=[ 1,2; @@ -28,35 +28,39 @@ function [ minc,maxc ] = getFeatureExt( img ) 0.3,0,4,2; 0.3,0,8,2; 0.4,0,4,1; - 0.4,0,8,2; + 0.4,0,8,1; 0.3,pi/2,4,2; 0.3,pi/2,8,2; 0.4,pi/2,4,1; - 0.4,pi/2,8,2;]; + 0.4,pi/2,8,1;]; gb = length(gbVec); sc = length(scVec); minc = []; maxc = []; + for cnl = 1:ncnls + for sec = 1:secs + section = getSection(cnls(:,:,cnl),sec,secs); + res = section; + minc = cat(2,minc,min(min(res))); + maxc = cat(2,maxc,max(max(res))); + end + end for i = 1:sc - for cnl = 1:ncnls - for sec = 1:secs - filt = schmidFilter(scVec(i,1),scVec(i,2)); - section = getSection(cnls(:,:,cnl),sec,secs); - res = imfilter(section, filt, 'symmetric'); - minc = cat(2,minc,min(min(res))); - maxc = cat(2,maxc,max(max(res))); - end + for sec = 1:secs + filt = schmidFilter(scVec(i,1),scVec(i,2)); + section = getSection(hsv(:,:,3),sec,secs); + res = imfilter(section, filt, 'symmetric'); + minc = cat(2,minc,min(min(res))); + maxc = cat(2,maxc,max(max(res))); end end for i = 1:gb - for cnl = 1:ncnls - for sec = 1:secs - filt = gaborFilter(gbVec(i,1),gbVec(i,2),gbVec(i,3),gbVec(i,4)); - section = getSection(cnls(:,:,cnl),sec,secs); - res = imfilter(section, filt, 'symmetric'); - minc = cat(2,minc,min(min(res))); - maxc = cat(2,maxc,max(max(res))); - end + for sec = 1:secs + filt = gaborFilter(gbVec(i,1),gbVec(i,2),gbVec(i,3),gbVec(i,4)); + section = getSection(hsv(:,:,3),sec,secs); + res = imfilter(section, filt, 'symmetric'); + minc = cat(2,minc,min(min(res))); + maxc = cat(2,maxc,max(max(res))); end end end @@ -18,7 +18,7 @@ function getVecs(dirname,minc,maxc) img=im2double(imread(strcat(indir,idlist(i).name))); I=genFeatureVec(img,minc,maxc); fprintf(fid,'%s ',n); - fprintf(fid,'%f ',I); + fprintf(fid,'%g ',I); fprintf(fid,'\n'); end fclose(fid); diff --git a/parGetVecs.m b/parGetVecs.m index f903494..2df0e91 100644 --- a/parGetVecs.m +++ b/parGetVecs.m @@ -1,6 +1,6 @@ function parGetVecs(dirname) - minc = zeros(2,1008); - maxc = zeros(2,1008); + minc = zeros(2,174); + maxc = zeros(2,174); parfor i=1:2 if i==1 [minc(i,:),maxc(i,:) ] = getVecsM(strcat(dirname,'_a')); |