-
Notifications
You must be signed in to change notification settings - Fork 50
Added 2D Gabor filter #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your contribution. To add some tests you can proceed as follows.
Do you have a reference you could add for the paper which you based your implementation on? |
|
Hi @zygmuntszpak I implemented the filter taking help from wikipedia and opencv, so should I write the references given in wikipedia as reference for the filter? |
|
@arijitkar98 I've had a quick glance at the literature to see if I can find a paper in which your particular parametrization appears verbatim. N. Petkov uses it frequently in his work as early as the 1990s. I couldn't find that particular parametrization in the original work of Daugman (the references on wikipedia). Hence, I suggest you use citation [1] instead. Having glanced at some of the articles, it seems that you have only implemented the real part of the complex Gabor filter. Shouldn't the function also return the corresponding complex part of the filter? [1] N. Petkov and P. Kruizinga, “Computational models of visual neurons specialised in the detection of periodic and aperiodic oriented visual stimuli: bar and grating cells,” Biological Cybernetics, vol. 76, no. 2, pp. 83–96, Feb. 1997. doi.org/10.1007/s004220050323 |
|
@zygmuntszpak Thank you for the input 😃 Should I make two separate functions for the real and complex parts or just one which takes an extra argument? |
|
Since the Gabor filter is traditionally defined as a complex sinusoid modulated by a Gaussian envelope, I think it makes sense for the function to return both the real and imaginary component. That is, I wouldn't necessarily write the API so that one has If the user is interested in just the real part then they can just assign the imaginary part to a dummy variable. For example, You may also want to write another helper function (not exposed to the user) such as Thank you for all your efforts! |
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
+ Coverage 90.84% 91.05% +0.21%
==========================================
Files 8 8
Lines 1070 1096 +26
==========================================
+ Hits 972 998 +26
Misses 98 98
Continue to review full report at Codecov.
|
|
@zygmuntszpak I have modified the gabor filter function as requested and have added required tests for the same. |
|
@arijitkar98 Looks great, and thank you for compiling such thoughtful tests. I have some further small suggestions. Instead of writing I noticed that you choose to make which would be more concise. Should we test that size_x and size_y are positive as well? Finally, to ensure maximum code coverage you could add a few further tests for which σ, λ and γ are zero so that the code associated with the error condition gets executed. |
|
Thank you both for putting so much effort and thought into this. I am sorry that I have found such little time to look into recent PRs and issues. That said it looks like @zygmuntszpak provided much more thoughtful feedback than I could have thought of. One small suggestion I would add is to instead of |
|
@zygmuntszpak @Evizero I have modified the validate_gabor function, keeping it outside of the main gabor function. For size_x and size_y, I have added a warning whenever the sizes are not positive, taking such an input value (6*σx+1) in function that will keep almost whole of the gaussian in the kernel. I have also added the test cases for the errors. Thank you for the code reviews 😃 |
|
@Evizero Are there any more changes required before this PR can be merged? |
src/kernel.jl
Outdated
| Returns a 2 Dimensional Complex Gabor kernel contained in a tuple where | ||
| size_x,size_y is the size of the kernel; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make those into bullet points, and surround the parameters in backticks?
e.g.
- `size_x`, `size_y` denote the size of the kernel
etc
|
one small docstring related comment. Other than that it looks good to me and i trust the judgement of @zygmuntszpak here |
|
Ping @Evizero |
|
Thanks! |
I have added the function gabor in kernel.jl that implements the 2D gabor kernel. I am not clear about how to add tests for checking the function.