OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Fri, 10 Nov 2017 03:25:35 -0600Shape Matching using Discrete Fourier Transformhttp://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/This is the very first time messing around with DFTs so apologizes inadvance if the Math just flies over my head or my question sounds rather stupid.
**Disclaimer:** I have not used [OpenCV API][1] for any DFT related steps stated below
---
What I have done so far
Let *T* represent the template image and *S* be an image I get from the camera feed
1. Grabbed the contours from *T*
2. Applied DFT on them
3. Made the attained DFTs scale invariant by dividing them with their magnitude i.e. `F[i] = F[i]/|F[i]|`
4. Computed their magnitude spectrum
5. Log-polar transformed the magnitudes and calculated the phases i.e. angles
---
My questions are:
1. Just to confirm, after performing Step 2, my attained descriptors are translation invariant correct?
2. How do I make them rotation invariant?
3. Now this is where I get really confused. After reading a couple papers on image registration, Steps 4 and 5 are needed. This is in order to calculate the phase correlation then trying to maximize this value. For my application, is this really necessary? Or do I just have to make the descriptors rotation invariant then calculate the euclidean distance to the descriptors of *S* and trying to minimize this value my final step?
---
Any help/suggestions are sincerely appreciated!
[1]: https://docs.opencv.org/3.2.0/d2/de8/group__core__array.html#gadd6cf9baf2b8b704a11b5f04aaf4f39dWed, 08 Nov 2017 17:22:29 -0600http://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/Comment by LBerger for <p>This is the very first time messing around with DFTs so apologizes inadvance if the Math just flies over my head or my question sounds rather stupid.</p>
<p><strong>Disclaimer:</strong> I have not used <a href="https://docs.opencv.org/3.2.0/d2/de8/group__core__array.html#gadd6cf9baf2b8b704a11b5f04aaf4f39d">OpenCV API</a> for any DFT related steps stated below</p>
<hr>
<p>What I have done so far</p>
<p>Let <em>T</em> represent the template image and <em>S</em> be an image I get from the camera feed</p>
<ol>
<li>Grabbed the contours from <em>T</em></li>
<li>Applied DFT on them</li>
<li>Made the attained DFTs scale invariant by dividing them with their magnitude i.e. <code>F[i] = F[i]/|F[i]|</code></li>
<li>Computed their magnitude spectrum</li>
<li>Log-polar transformed the magnitudes and calculated the phases i.e. angles</li>
</ol>
<hr>
<p>My questions are:</p>
<ol>
<li>Just to confirm, after performing Step 2, my attained descriptors are translation invariant correct?</li>
<li>How do I make them rotation invariant?</li>
<li>Now this is where I get really confused. After reading a couple papers on image registration, Steps 4 and 5 are needed. This is in order to calculate the phase correlation then trying to maximize this value. For my application, is this really necessary? Or do I just have to make the descriptors rotation invariant then calculate the euclidean distance to the descriptors of <em>S</em> and trying to minimize this value my final step?</li>
</ol>
<hr>
<p>Any help/suggestions are sincerely appreciated!</p>
http://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/?comment=178059#post-id-178059Applied DFT on them = Applied DFT on coordinates point
.... F[i] = F[i]/|F[i]| no F[i] = F[i]/Surface (except F(0) = gravity center)
How do I make them rotation invariant? you have to adjust fourier descriptors relative to reference shape
questions 3 adjust coefficient
http://fourier.eng.hmc.edu/e161/lectures/fd/node1.htmlFri, 10 Nov 2017 03:25:35 -0600http://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/?comment=178059#post-id-178059Comment by eshirima for <p>This is the very first time messing around with DFTs so apologizes inadvance if the Math just flies over my head or my question sounds rather stupid.</p>
<p><strong>Disclaimer:</strong> I have not used <a href="https://docs.opencv.org/3.2.0/d2/de8/group__core__array.html#gadd6cf9baf2b8b704a11b5f04aaf4f39d">OpenCV API</a> for any DFT related steps stated below</p>
<hr>
<p>What I have done so far</p>
<p>Let <em>T</em> represent the template image and <em>S</em> be an image I get from the camera feed</p>
<ol>
<li>Grabbed the contours from <em>T</em></li>
<li>Applied DFT on them</li>
<li>Made the attained DFTs scale invariant by dividing them with their magnitude i.e. <code>F[i] = F[i]/|F[i]|</code></li>
<li>Computed their magnitude spectrum</li>
<li>Log-polar transformed the magnitudes and calculated the phases i.e. angles</li>
</ol>
<hr>
<p>My questions are:</p>
<ol>
<li>Just to confirm, after performing Step 2, my attained descriptors are translation invariant correct?</li>
<li>How do I make them rotation invariant?</li>
<li>Now this is where I get really confused. After reading a couple papers on image registration, Steps 4 and 5 are needed. This is in order to calculate the phase correlation then trying to maximize this value. For my application, is this really necessary? Or do I just have to make the descriptors rotation invariant then calculate the euclidean distance to the descriptors of <em>S</em> and trying to minimize this value my final step?</li>
</ol>
<hr>
<p>Any help/suggestions are sincerely appreciated!</p>
http://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/?comment=178000#post-id-178000You have got to be kidding! I'll look into it. Well just to quench my thirst for knowledge (I feel like I'm so close to getting it done), any thoughts on my three questions? Same goes to @LBergerThu, 09 Nov 2017 08:29:47 -0600http://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/?comment=178000#post-id-178000Comment by sturkmen for <p>This is the very first time messing around with DFTs so apologizes inadvance if the Math just flies over my head or my question sounds rather stupid.</p>
<p><strong>Disclaimer:</strong> I have not used <a href="https://docs.opencv.org/3.2.0/d2/de8/group__core__array.html#gadd6cf9baf2b8b704a11b5f04aaf4f39d">OpenCV API</a> for any DFT related steps stated below</p>
<hr>
<p>What I have done so far</p>
<p>Let <em>T</em> represent the template image and <em>S</em> be an image I get from the camera feed</p>
<ol>
<li>Grabbed the contours from <em>T</em></li>
<li>Applied DFT on them</li>
<li>Made the attained DFTs scale invariant by dividing them with their magnitude i.e. <code>F[i] = F[i]/|F[i]|</code></li>
<li>Computed their magnitude spectrum</li>
<li>Log-polar transformed the magnitudes and calculated the phases i.e. angles</li>
</ol>
<hr>
<p>My questions are:</p>
<ol>
<li>Just to confirm, after performing Step 2, my attained descriptors are translation invariant correct?</li>
<li>How do I make them rotation invariant?</li>
<li>Now this is where I get really confused. After reading a couple papers on image registration, Steps 4 and 5 are needed. This is in order to calculate the phase correlation then trying to maximize this value. For my application, is this really necessary? Or do I just have to make the descriptors rotation invariant then calculate the euclidean distance to the descriptors of <em>S</em> and trying to minimize this value my final step?</li>
</ol>
<hr>
<p>Any help/suggestions are sincerely appreciated!</p>
http://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/?comment=177950#post-id-177950did you miss recently contributed [FourierDescriptors implementation](https://github.com/opencv/opencv_contrib/commit/a44a2ba730f0c9709d0632d273f32292e70ec12c) by @LBergerWed, 08 Nov 2017 18:46:58 -0600http://answers.opencv.org/question/177945/shape-matching-using-discrete-fourier-transform/?comment=177950#post-id-177950