Skip to content

Instantly share code, notes, and snippets.

@clarle
Created March 22, 2012 23:48
Show Gist options
  • Save clarle/2165568 to your computer and use it in GitHub Desktop.
Save clarle/2165568 to your computer and use it in GitHub Desktop.
Convolution Script for BIOL 319
clear all; close all;
A = imread('BrownDischer079.tiff');
A = single(A);
scale = max(max(A))/256;
A = A/scale;
figure(1);
co=[0:255]/256; colormap([co;co;co]');
image(A); axis off tight; title('original image');
[x,y] = meshgrid(-25:25);
gFilter=exp(-.5*(x.^2/2+y.^2/45));
laplaceFilter=[0 -1 0; -1 4 -1; 0 -1 0];
K=conv2(laplaceFilter,gFilter);
combinedFilter=K(2:(end-1),2:(end-1));
filteredImage = conv2(combinedFilter, A);
figure(2);
colormap([co;co;co]');
image(filteredImage); axis off tight; title('filtered image');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment