python高斯滤波器高通锐化,MATLAB图像锐化 - 使用(1-高斯低通滤波器)的高斯高通滤波器...

I am trying to sharpen an image by designing 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 sharpened image. Instead, I got a white image with some colors on a small region of the image. Can someone help? Thank you.

解决方案

Try this:

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

1 is a scalar. You need a 5x5 array with one in the center. Furthermore, the filter elements must sum to one if you want to conserve brightness, so you need to double the central value to counter the amount you are subtracting.

你可能感兴趣的:(python高斯滤波器高通锐化)