Ask Your Question

Gabor filter (Real and imaginary images)

asked 2013-11-14 11:56:48 -0500

balasubramaniyan94 gravatar image

Hi to everyone,

As surfing through net, i got that gabor filter can be used for texture analysis.  And the output of the gabor filter will be real and imaginary image.

I have used the following code from opencv for gabor filter.

void Process(int , void *)
    const CvArr* m;
    std::vector<int> qualityType;
    double sig = pos_sigma;
    double lm = 0.5+pos_lm/100.0;
    double th = pos_th;
    double ps = pos_psi;
    cv::Mat kernel = mkKernel(kernel_size, sig, th, lm, ps);
    cv::filter2D(src_f, dest, CV_32F, kernel);
    cv::Mat Lkernel(kernel_size*20, kernel_size*20, CV_32F);
    cv::resize(kernel, Lkernel, Lkernel.size());
    Lkernel /= 2.;
    Lkernel += 0.5;
    cv::imshow("Kernel", Lkernel);
    cv::Mat mag;
    cv::pow(dest, 2.0, mag);
    imwrite( "Templatemag.bmp", dest );
    cv::imshow("Mag", mag); 

int main(int argc, char** argv)
    src_f = cv::imread("sample.bmp",0);
    unsigned char *temp;
    if (!kernel_size%2)
    cv::namedWindow("Process window", 1);
    cv::createTrackbar("Sigma", "Process window", &pos_sigma, 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);
    return 0;

And the output of the above coding is as attached with this post.

We are unable to understand the real and imaginary image from the attached output.

Helps us to proceed further.  Share us any link which describes details about the real and imaginary image.
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-11-15 00:20:38 -0500

kook gravatar image

a kernel with parameter 'psi + pi/2' will be the imaginary part. I think this will help you - make the kernel in the frequency domain will get better performance -

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-11-14 11:56:48 -0500

Seen: 2,005 times

Last updated: Nov 15 '13