MATLAB: Sharpening image using first order derivative

Image Processing Toolboxlapacian second order derivative to sharpen imagesharpen image

what is the MATLAB code to sharpen an image using first order derivative?

Best Answer

You can sharpen the image by adding the Laplacian to the original image. This can all be done in one convolution:
windowWidth = 3;
kernel = -1 * ones(windowWidth);
middleRow = ceil(windowWidth / 2);
kernel(middleRow, middleRow) = 2 * windowWidth ^ 2 - 1;
sharpenedImage = conv2(double(grayImage), kernel, 'same');
imshow(sharpenedImage, []);