I have the following code for a applying a Gaussian filter to an image. From what I understand this is a low pass filter. Now I have to convert this into a high-pass filter, and from what we were told from the instructions, one difference between Gaussian low and high pass filters is that for a high-pass, the sum of the elements in the filter kernel should sum up to zero as opposed to one like for the-low pass filter. How should I go about doing this?
%%horizontal and vertical coordinates
coordinates = -floor(N/2) : floor(N/2);
[X Y] = meshgrid(coordinates, coordinates);
N = 12;
sigma=2;
gfilter = exp(-(X.^2 + Y.^2)/(2*sigma.^2));
gfilter = gfilter/sum(gfilter(:));
I = mean(double(imread('image.png')),3);
GaussBlur = conv2(I,gfilter);
%%plot images side by side
subplot(1,2,1);
imshow(I, []);
subplot(1,2,2);
imshow(GaussBlur, []);