diff options
-rw-r--r-- | gaborFilter.m | 2 | ||||
-rw-r--r-- | genFeatureVec.m | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/gaborFilter.m b/gaborFilter.m index 8cf9260..8cac0bd 100644 --- a/gaborFilter.m +++ b/gaborFilter.m @@ -10,4 +10,4 @@ function fout = gaborFilter(gamma,theta,lambda,sigma) x_theta=x*cos(theta)+y*sin(theta); y_theta=-x*sin(theta)+y*cos(theta); - fout=filterNorm(exp(-0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*exp(2*i*pi/lambda*x_theta));
\ No newline at end of file + fout=filterNorm(exp(-0.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta));
\ No newline at end of file diff --git a/genFeatureVec.m b/genFeatureVec.m index 4ac8ec8..7690f25 100644 --- a/genFeatureVec.m +++ b/genFeatureVec.m @@ -7,6 +7,9 @@ function vec = genFeatureVec(img) cnls(:,:,4:6) = rgb2ycbcr(img); hsv = rgb2hsv(img); cnls(:,:,7:8) = hsv(:,:,1:2); + for i=1:ncnls + cnls(:,:,i) = imgeq(cnls(:,:,i)); + end % Schmid scVec=[ 1,2; @@ -38,8 +41,8 @@ function vec = genFeatureVec(img) for cnl = 1:ncnls 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)))); + pos = sum(sum(filt.*(filt>0))); + neg = 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); @@ -51,11 +54,11 @@ function vec = genFeatureVec(img) for cnl = 1:ncnls 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)))); + pos = sum(sum(filt.*(filt>0))); + neg = 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); + v = histcounts(imfilter(section, filt, 'symmetric'),(0:bins)*ss+neg); vec=cat(2,vec,v); end end |