OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 14 Nov 2017 05:36:46 -0600Frequency filtering for pattern matchinghttp://answers.opencv.org/question/178282/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;
Tue, 14 Nov 2017 05:36:00 -0600http://answers.opencv.org/question/178282/frequency-filtering-for-pattern-matching/Comment by LLSH for <p>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: <a href="https://homepages.inf.ed.ac.uk/rbf/HIPR2/freqfilt.htm">https://homepages.inf.ed.ac.uk/rbf/HI...</a></p>
<pre><code>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;
</code></pre>
http://answers.opencv.org/question/178282/frequency-filtering-for-pattern-matching/?comment=178283#post-id-178283this is written in C++Tue, 14 Nov 2017 05:36:46 -0600http://answers.opencv.org/question/178282/frequency-filtering-for-pattern-matching/?comment=178283#post-id-178283