OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Mon, 15 Sep 2014 14:51:56 -0500Does using Gabor Energy disregard the sign of the Gabor kernel?http://answers.opencv.org/question/42056/does-using-gabor-energy-disregard-the-sign-of-the-gabor-kernel/I am looking into feature extraction using Gabor filters. I belive the steps are:
1. Generate a set of gabor kernals. (An matrix of floating point number valuing between -1, +1)
2. Convert the image into a floating point matrix.
3. Convolute each Gabor kernel with the image, centred at each pixel in turn. (i.e. The first output image is the input image mutiplied by the pixel value of the coresponding pixel in the gabor kernal, then center the gabor kernal at the next pixel and repeat)
4. Calculate the 'energy' of the result by summing the squares of each pixel.
I think I must be missing something since if that was the case then the sign of the Gabor kernel would not matter.
For example if a pixel had a intensity of 0.1 and it was convoluted with a Gabor kernel with a corresponding pixel value of 0.5 then the output would be
(0.1 * 0.5)^2 = 0.0025
This would be the same if the gabor kernal had a value of -0.5
(0.1 * -0.5)^2 = 0.0025
Therefore it would not matter what sign the Gabor kernels would be, therefore these 2 kernels would be effectively identical.
![enter image description here][1]
![enter image description here][2]
[1]: http://i.stack.imgur.com/Rfk4F.png
[2]: http://i.stack.imgur.com/jk9aF.pngMon, 15 Sep 2014 14:13:26 -0500http://answers.opencv.org/question/42056/does-using-gabor-energy-disregard-the-sign-of-the-gabor-kernel/Answer by _Robert for <p>I am looking into feature extraction using Gabor filters. I belive the steps are:</p>
<ol>
<li>Generate a set of gabor kernals. (An matrix of floating point number valuing between -1, +1)</li>
<li>Convert the image into a floating point matrix.</li>
<li>Convolute each Gabor kernel with the image, centred at each pixel in turn. (i.e. The first output image is the input image mutiplied by the pixel value of the coresponding pixel in the gabor kernal, then center the gabor kernal at the next pixel and repeat)</li>
<li>Calculate the 'energy' of the result by summing the squares of each pixel.</li>
</ol>
<p>I think I must be missing something since if that was the case then the sign of the Gabor kernel would not matter. </p>
<p>For example if a pixel had a intensity of 0.1 and it was convoluted with a Gabor kernel with a corresponding pixel value of 0.5 then the output would be </p>
<pre><code>(0.1 * 0.5)^2 = 0.0025
</code></pre>
<p>This would be the same if the gabor kernal had a value of -0.5</p>
<pre><code>(0.1 * -0.5)^2 = 0.0025
</code></pre>
<p>Therefore it would not matter what sign the Gabor kernels would be, therefore these 2 kernels would be effectively identical.</p>
<p><img alt="enter image description here" src="http://i.stack.imgur.com/Rfk4F.png">
<img alt="enter image description here" src="http://i.stack.imgur.com/jk9aF.png"></p>
http://answers.opencv.org/question/42056/does-using-gabor-energy-disregard-the-sign-of-the-gabor-kernel/?answer=42060#post-id-42060From looking at the some sample source code I realise my mistake.
https://github.com/juancamilog/gpu_convolve_test/blob/master/gpu_convolve_test.cpp
The convolution step **sums** the multiplication of corresponding pixels, which takes into account the sign of the Gabor kernel.Mon, 15 Sep 2014 14:51:56 -0500http://answers.opencv.org/question/42056/does-using-gabor-energy-disregard-the-sign-of-the-gabor-kernel/?answer=42060#post-id-42060