Apply a Local Averaging Mask
Afficher commentaires plus anciens
How can you apply a 3x3 local averaging mask to enhance the sharpness in an image. How can you set the mask? I'd like to get a better understanding in how this method of filtering an image works and how to compute the algorithm.
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 27 Fév 2018
Modifié(e) : Image Analyst
le 14 Août 2019
You can use imfilter() instead of convolution, but it's doing pretty much a similar thing (multiplying a sliding window by the image under the window). To sharpen edges you'd use a kernel that's 17 in the middle and -1 around the sides:
kernel = -1 * ones(3);
kernel(3,3) = 17;
output = conv2(double(intputImage), kernel, 'same');
imshow(output, []);
See my attached manual convolution, though I don't recommend it. It's mainly for students who are not allowed to use built-in functions.
The theory for the -1, 17 thing is that it's the average gradient around the 8 directions (which gives a flat, harsh, Laplacian edge detection image), plus 9 in the center to add back in the original image so that the result looks like a edge enhanced image rather than a pure edge detection image. If you need more explanation on the theory, ask.
Catégories
En savoir plus sur Blocked Images dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!