- First median filter the whole image
- Get a mask of the salt and papper noise, where values are either 0 or 255 or whatever values you want to use.
- Replace the original image with the median filtered values but ONLY within the noise mask, not everywhere.
How do you apply a 3x3 median filter on an image that is noisy (salt and pepper) , and what is it supposed to do?
65 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
is this correct?
inpict = imread('Q1_noisy_image (1).tif');
A = medfilt2(inpict,[3 3]);
imshow(A)
0 Commenti
Risposte (3)
Image Analyst
il 2 Dic 2023
If inpict is a gray scale image, that would apply a median filter to ALL pixels in the image, not just the impulse/salt&pepper noise.
A median filter's claim to fame is that it smooths noisy areas but leaves true edges sharp (it doesn't blur step edges).
If you want a median filter to operate on only salt and pepper noise, you have to
Something like
filteredImage = medfilt2(grayImage, [3,3]);
mask = (grayImage == 0) | (grayImage == 255);
grayImage(mask) = filteredImage(mask);
For a full demo, see my attached demos. For a color image, do it one color channel at a time.
0 Commenti
DGM
il 2 Dic 2023
Modificato: DGM
il 2 Dic 2023
This is the third time you've asked this question. Why?
2 Commenti
DGM
il 2 Dic 2023
Modificato: DGM
il 2 Dic 2023
In the future, try to keep things about one question in a common thread so that efforts don't get divided. It's okay to revise your question either by editing it or by using comments.
FWIW, the link I'd provided in 2054999 includes a link to the demos that Image Analyst also posted above.
vikash
il 6 Dic 2024 alle 2:59
write a matlab code in to perform image sharpening operation using 3x3 min filter and 3x3 max filter and median filter note sart and pepper noise model for image degreadation
2 Commenti
DGM
il 6 Dic 2024 alle 15:57
This isn't an answer to the question. You just pasted some part of your homework assignment.
Off the top of my head, I don't think I've seen image sharpening done via simple min, max, and median filtering. I saw some old papers on sharpening via grayscale morphological filtering, but I have to assume that's not relevant.
I also don't see why sharpening a noisy image would be a good idea. If the sharpening filter is supposed to also have other properties, you haven't mentioned them.
The most obvious assumption is that you don't actually want a sharpening filter at all. If you want a noise removal filter, then that's already been answered.
Image Analyst
il 7 Dic 2024 alle 4:58
For a local median filter use medfilt2
I have no idea what "note sart and pepper noise model for image degreadation" means. Try Google translate.
This looks like a homework problem. If you have any questions ask your instructor or read the link below to get started:
Obviously, if it is homework, we can't give you the full solution because you're not allowed to turn in our code as your own.
Another resource that MathWorks Central offers is the AI Chat Playground (on the blue banner above). You can paste your problem text into there and get code. However to be ethical you need to make sure that your professor is willing to accept AI generated code as your own. If he/she is against that and wants you to create your own code, and you submit code from AI or other people, you could be running a risk.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!