summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-05-12 14:23:24 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-05-12 14:23:24 +0800
commitd0a72f92977baebaed915fbb2d14f2d5ddec8306 (patch)
tree3f677e79883ca2b8c1a4c811b110c48827e78266
parent34de475999a22ac7280411e15339e77a0c8dbc2e (diff)
downloadfeatext-d0a72f92977baebaed915fbb2d14f2d5ddec8306.tar.gz
featext-d0a72f92977baebaed915fbb2d14f2d5ddec8306.tar.bz2
featext-d0a72f92977baebaed915fbb2d14f2d5ddec8306.zip
misc
-rw-r--r--genFeatureVec.m42
-rwxr-xr-xgenRid.sh9
-rw-r--r--getVecs.m1
-rw-r--r--parGetVecs.m12
-rwxr-xr-xrunMatlab.sh10
5 files changed, 55 insertions, 19 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
diff --git a/genRid.sh b/genRid.sh
new file mode 100755
index 0000000..b2676f2
--- /dev/null
+++ b/genRid.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+ofile=${1}.rid
+
+runMatlab parGetVecs \'${1}\'
+echo 16128 > ${ofile}
+cat ${1}_a.txt >> ${ofile}
+cat ${1}_b.txt >> ${ofile}
+echo 0 >> ${ofile}
diff --git a/getVecs.m b/getVecs.m
index 40f08cd..0f0a615 100644
--- a/getVecs.m
+++ b/getVecs.m
@@ -21,6 +21,5 @@ function getVecs(dirname)
fprintf(fid,'%f ',I);
fprintf(fid,'\n');
end
- fprintf(fid,'0');
fclose(fid);
end \ No newline at end of file
diff --git a/parGetVecs.m b/parGetVecs.m
index 4097f5a..53a2cce 100644
--- a/parGetVecs.m
+++ b/parGetVecs.m
@@ -1,7 +1,9 @@
-parfor i=1:2
- if i==1
- getVecs('test_a');
- else
- getVecs('test_b');
+function parGetVecs(dirname)
+ parfor i=1:2
+ if i==1
+ getVecs(strcat(dirname,'_a'));
+ else
+ getVecs(strcat(dirname,'_b'));
+ end
end
end \ No newline at end of file
diff --git a/runMatlab.sh b/runMatlab.sh
new file mode 100755
index 0000000..88bb130
--- /dev/null
+++ b/runMatlab.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+matlab_exec=matlab
+tmpdir="/tmp"
+inp="${1}(${2})"
+scriptfile=${tmpdir}/matlab_command_${1}.m
+echo ${inp} > ${scriptfile}
+cat ${scriptfile}
+${matlab_exec} -nodisplay -nosplash < ${scriptfile}
+rm ${scriptfile}