MATLAB Image Sharpening - Gaussian high-pass filter using (1- Gaussian low-pass filter)

I am trying to sharpen the image by creating a Gaussian high-pass filter. I would like to do this using the fact that the high-pass filter is equivalent to the identity matrix minus the low-pass filter, so I did the following:

image= imread('Question3_Data-Cats.jpg'); % read image H = 1 - fspecial('gaussian' ,[5 5],2); % create unsharp mask sharpened = imfilter(image,H); % create a sharpened version of the image using that mask imshow([image sharpened]); %showing input & output images 

I did not get a sharp image. Instead, I got a white image with some colors in a small area of โ€‹โ€‹the image. Can anyone help? Thanks.

+1
source share
3 answers

Try the following:

 H = padarray(2,[2 2]) - fspecial('gaussian' ,[5 5],2); % create unsharp mask 

1 - scalar. You need a 5x5 array with one in the center. In addition, filter elements must add up to unity if you want to maintain brightness, so you need to double the center value to withstand the amount you subtract.

+4
source

Let g be the core of the gaussian and f image. Then f * g (convolution) gives a blurry version of the image. This means a low-passed version of the image.

Then consider f - f \ ast g . This means image - lowpass image . This gives a high-passed image version. It contains only images. Details are on a white background. I think this is the image that you are getting right now.

image detail

After you have extracted the image details from the image, you must add them back to the image in order to get a sharpened image.

Sharpen image

This means that you can get a sharpened image by convolving 2e - g with your image (this is a blur mask).

You can get 2e from matlab with padarray(2,[2 2]) and g with fspecial('gaussian' ,[5 5],2) .

 H = padarray(2,[2 2]) - fspecial('gaussian' ,[5 5],2); %create unsharp mask 

Sometimes you need to control the brightness of the image details. You can do it with

sharpen image = image + alpha (image details)

control the brightness of image details

+4
source
 I= imread('peppers.png'); % read image H = padarray(2,[2 2]) - fspecial('gaussian' ,[5 5],2); % create unsharp mask % create unsharp mask figure,imshow(I); K = imfilter(I,H); % create a sharpened version of the image using that mask figure,imshow(K); %showing input & output images 
-1
source

All Articles