Last active
August 29, 2015 14:17
-
-
Save lettergram/c2d90f2a3cca3514ba69 to your computer and use it in GitHub Desktop.
Applying Derived Gaussian Filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Convert an image to double for increased precision | |
img = double(img); | |
% Find two derived gaussians with respect to x and y | |
[hx, hy] = gradient(fspecial('gaussian',[5 5],sigma)); | |
% Run the filters over the image, generating a filtered image | |
% Leaves x and y images of edges | |
gx = double(imfilter(img,hx,'replicate', 'conv')); | |
gy = double(imfilter(img,hy,'replicate', 'conv')); | |
% Take the absolute value, and combine the x and y edges | |
mag = sqrt((gx .* gx) + (gy .* gy)); | |
% Use non-maxima suppression | |
[mag, ] = max(mag, [], 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment