Schmid也是一种类Gabor图像滤波器,在这篇文章[1]中有详细推导和介绍。
一种更简洁的表达公式是:
当中,r为核半径,Z为归一化參数,τ和σ是比較重要的參数,在ReID提取TextFeature中,常常使用例如以下一系列參数:
(2,1), (4,1), (4,2), (6,1), (6,2), (6,3), (8,1), (8,2), (8,3), (10,1),
(10,2), (10,3), (10,4)
此外,还结合前面的Gabor滤波器,γ,θ,λ,σ的參数分别使用:(0.3,0,4,2), (0.3,0,8,2),
(0.4,0,4,1), (0.4,0,4,1), (0.3,π/2,4,2), (0.3,π/2,8,2), (0.4,π/2 ,4,1),
(0.4,π/2,4,1)
下面是11个滤波核的示意图:
生成Schmid核函数代码:
Mat getSchmidFilter(float tao, float sigma){
float r = sigma/(4.0f*tao);
float sigma2 = sigma*sigma;
//int half_filter_size = int(r+0.5);
int half_filter_size = 10;
int filter_size = 2*half_filter_size+1;
Mat schmid = Mat::zeros(filter_size,filter_size,CV_32F);
float filter_sum = 0.0f;
for(int i=0;i<filter_size;i++){
float* s = schmid.ptr<float>(i);
for(int j=0;j<filter_size;j++){
float x = i-half_filter_size;
float y = j-half_filter_size;
r = sqrt(x*x+y*y);
float tmp = 2*PI*tao*r/sigma;
float tmp2 = r*r/(2.0f*sigma2);
s[j] = cos(tmp)*exp(-tmp2);
filter_sum += s[j];
}
}
//cout<<filter_size<<" "<<filter_sum<<endl;
//cout<<schmid<<endl;
if(abs(filter_sum-0.0f)<1e-6){
return schmid;
}
for(int i=0;i<filter_size;i++){
float* s = schmid.ptr<float>(i);
for(int j=0;j<filter_size;j++){
s[j]/=filter_sum;
}
}
return schmid;
}
对图像进行卷积滤波效果如图:
參考文献:
[1] Schmid,
Cordelia. "Constructing models for content-based image retrieval."Computer
Vision and Pattern Recognition, 2001. CVPR 2001. Proceedings of the 2001 IEEE
Computer Society Conference on.
Vol. 2. IEEE, 2001.
[2] Gray, Douglas, and Hai Tao. "Viewpoint invariant pedestrian
recognition with an ensemble of localized features." Computer Vision–ECCV 2008.
Springer Berlin Heidelberg, 2008. 262-275.
(转载请注明作者和出处:http://blog.csdn.net/xiaowei_cqu 未经同意请勿用于商业用途)
【图像处理】Schmid滤波器