summaryrefslogtreecommitdiff
path: root/genFeatureVec.m
diff options
context:
space:
mode:
Diffstat (limited to 'genFeatureVec.m')
-rw-r--r--genFeatureVec.m55
1 files changed, 55 insertions, 0 deletions
diff --git a/genFeatureVec.m b/genFeatureVec.m
new file mode 100644
index 0000000..75fa0e8
--- /dev/null
+++ b/genFeatureVec.m
@@ -0,0 +1,55 @@
+function vec = genFeatureVec(img)
+ bins = 16;
+ ncnls = 8;
+ cnls = zeros(size(img,1), size(img,2),ncnls);
+ cnls(:,:,1:3) = img;
+ cnls(:,:,4:6) = rgb2ycbcr(img);
+ hsv = rgb2hsv(img);
+ cnls(:,:,7:8) = hsv(:,:,1:2);
+ % Schmid
+ scVec=[
+ 1,2;
+ 1,4;
+ 2,4;
+ 1,6;
+ 2,6;
+ 3,6;
+ 1,8;
+ 2,8;
+ 3,8;
+ 1,10;
+ 2,10;
+ 3,10;
+ 4,10];
+ gbVec = [
+ 0.3,0,4,2;
+ 0.3,0,8,2;
+ 0.4,0,4,1;
+ 0.4,0,8,2;
+ 0.3,pi/2,4,2;
+ 0.3,pi/2,8,2;
+ 0.4,pi/2,4,1;
+ 0.4,pi/2,8,2;];
+ gb = length(gbVec);
+ sc = length(scVec);
+ 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);
+ 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);
+ end
+ end \ No newline at end of file