Skip to content
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

Gabor filter #28

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Gabor filter #28

wants to merge 25 commits into from

Conversation

khilanravani
Copy link

A partial pure implementation of Gabor filter. A few changes yet to be made before producing sample outputs.

khilanravani and others added 25 commits May 28, 2018 15:49
We first extract some information from the image - width, height etc., convert
to luma and compute gradients. Then, for each pixel (x,y), we compute rho = xcos(theta) + ysin(theta).
After a few more transformations and finding the bins with highest values, we generate the
resulting image.
Preliminary Hough transform implementation
It is used to improve contrast in images and works by performing
enhancement on small 'contextual' regions or neighborhood of each
pixel in the given image.
Fix the horizontal kernel of Sobel filter.
* Mean filter version 1
@khilanravani khilanravani changed the title Gabor filter Initial version Gabor filter Aug 19, 2018

gaborfn
:: (RealFloat p, Fractional p) => p -> p -> p -> p -> p -> p -> p -> Complex p
gaborfn λ θ ψ σ γ x y = exp ( (-0.5) * ((x'^2 + γ^2*y'^2) / (σ^2)) :+ 0) * exp ( 0 :+ (2*pi*(x'/λ+ψ)) )
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(2*pi*(x'/λ+ψ)), that's incorrect, should be (2*pi*x'/λ+ψ)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great, you copy pasted it from Wikipedia, even managed to copy it with an error.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very sorry sir, will correct that. I was unaware of the exact formula and found the haskell version on wiki. Will correct it.

θ = pi
ψ = 0
σ = 4.0
γ = 0.5
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did you come up with all these values? They are already supplied as arguments.

gaborFilter :: (Array arr cs e, Array arr X e, Floating e, Fractional e) =>
Border (Pixel cs e) -- ^ Border resolution technique.
-> Filter arr cs e
gaborFilter !border =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really confused by this implementation. I might be wrong, but isn't the gabor filter, after getting created with gaborfn, supposed to be used simply as a convolution kernel? Could you give me a reference to the source you are using for this implementation, besides the wikipedia one of course. In fact it be nice if you could include all source you use for all algorithms, if not in source code at least in the PR.

Just by looking at the code it seems as if you are assuming that gabor kernel is separable, which I think is a mistake, so please correct me if I am wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants