您可以参考此 c++ 代码来查找图像的 Gabor Edge 检测器输出。我相信您也可以在 java 中形成类似的!使用这些值来找到你想要的内核类型。
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <math.h>
using namespace cv;
int pos_kernel_size=21;
int pos_sigma= 5;
int pos_lm = 50;
int pos_th = 0;
int pos_gamma= 0;
int pos_psi = 90;
Mat src_f;
Mat dest;
void Process(int , void *)
{
int kernel_size=(pos_kernel_size-1)/2;
Size KernalSize(kernel_size,kernel_size);
double Sigma = pos_sigma;
double Lambda = 0.5+pos_lm/100.0;
double Theta = pos_th*CV_PI/180;
double psi = pos_psi*CV_PI/180;;
double Gamma = pos_gamma;
Mat kernel = getGaborKernel(KernalSize, Sigma, Theta, Lambda,Gamma,psi);
filter2D(src_f, dest, CV_32F, kernel);
imshow("Process window", dest);
Mat Lkernel(kernel_size*20, kernel_size*20, CV_32F);
resize(kernel, Lkernel, Lkernel.size());
Lkernel /= 2.;
Lkernel += 0.5;
imshow("Kernel", Lkernel);
Mat mag;
pow(dest, 2.0, mag);
imshow("Mag", mag);
}
int main(int argc, char** argv)
{
Mat image = imread("Gabor.bmp",0);
cv::imshow("Src", image);
image.convertTo(src_f, CV_32F, 1.0/255, 0);
if (!pos_kernel_size%2)
{
pos_kernel_size+=1;
}
cv::namedWindow("Process window", 1);
cv::createTrackbar("Sigma", "Process window", &pos_sigma, pos_kernel_size, Process);
cv::createTrackbar("Lambda", "Process window", &pos_lm, 100, Process);
cv::createTrackbar("Theta", "Process window", &pos_th, 180, Process);
cv::createTrackbar("Psi", "Process window", &pos_psi, 360, Process);
cv::createTrackbar("Gamma", "Process window", &pos_gamma, 100, Process);
Process(0,0);
waitKey(0);
return 0;
}