Gabor core parameters in OpenCV

I have to use the Gabor filter in my application, but I do not mean these parameter values ​​of the OpenCV methods. I want to encode the iris. Run the Gabor filter and get the functions (I want to do this for 12 sets of Gabor parameter values). Then I want to calculate Hamming dynamics and do authentication.

If someone can write parameter ranges here or a way to calculate them in a function:

Imgproc.getGaborKernel(new Size(kSize[j], kSize[j]), sigma, theta, lambda, gamma);

      

I'll be very thankful. Of course, I tried to appoint it myself, but to no avail.

Example file:

Normalized iris

+3


source to share


1 answer


You can refer to this C ++ code for finding the Gabor Edge detector output for your image. I'm sure you can create a similar one in java too! Play with these values ​​to find the type of kernel you want.



#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;
}

      

+7


source







All Articles