Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Gabor filter (Real and imaginary images)

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;
    qualityType.push_back(CV_IMWRITE_JPEG_QUALITY);
    qualityType.push_back(90);
    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)
    {
        kernel_size+=1;
    }
    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);
    Process(0,0);
    cv::waitKey(0);
    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.