Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Frequency filtering for pattern matching

I am trying to perform a pattern matching. I am stuck at doing frequency filtering when i try to multiply my image and my mask. Both of my image and my mask are suppose to be in the fourier space while I multiply them. Can you help me to solve this problem. Thanks I find the step in this website: https://homepages.inf.ed.ac.uk/rbf/HIPR2/freqfilt.htm

Mat planes[] = {Mat_<float>(roi), Mat::zeros(roi.size(), CV_32F)};  //roi is my mask
Mat complexI;
merge(planes, 2, complexI);
dft(complexI, complexI, DFT_COMPLEX_OUTPUT);

Mat planes2[] = {Mat_<float>(imgCanny), Mat::zeros(imgCanny.size(), CV_32F)}; //imgCanny is my image
Mat complexP;    //Complex plane to contain the DFT coefficients {[0]-Real,[1]-Img}
merge(planes2, 2, complexP);
dft(complexP, complexP);  // Applying DFT

Mat complexA;
complexA =  complexP * complexI;