How do I sharpen/refocus an image using only the fspecial and conv2 commands?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
We are studying simple convolution in my class. So far we have convolved 2 signals and reduced noise from sine waves. Now we've an assignment to refocus an image.
This is my code so far:
x=imread('Sgrayblur.png');
h=
y=conv2(x,h);
subplot(1,2,1),imshow(x);
subplot(1,2,2),imshow(y);
What must I put after 'h='? Is it possible to use fspecial to sharpen without using imfilter or the like?
0 commentaires
Réponses (1)
Image Analyst
le 14 Avr 2015
You can use a Laplacian to get a high pass filter, then add it to the original image to sharpen the edges. Of course because convolution is a linear filter, you can simply add the kernels together and do a convolution once. So a 3 by 3 filter for a high boost filter would be:
kernel = [-1, -1, -1; -1, 17, -1; -1, -1, -1]/ 9;
sharpenedImage = conv2(double(grayImage), kernel, 'same');
You can use imfilter() instead of conv2() if you want.
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!