- First filter the whole image
- Get a mask of the salt and pepper noise, where values are either 0 or 255 or whatever values you want to use.
- Replace the original image with the filtered values but ONLY within the noise mask, not everywhere.
How do you apply a 3x3 low pass filter on an image that is noisy (salt and pepper) , and what is it supposed to do?
21 ビュー (過去 30 日間)
古いコメントを表示
is it supposed to be like
inpict = imread('Q1_noisy_image (1).tif');
A = imgaussfilt(inpict,[3 3]);
imshow(A)
0 件のコメント
回答 (1 件)
Image Analyst
2023 年 12 月 2 日
Basically the same as your other question where you used the median filter. So, borrowing from my answer there:
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 gaussian filter is a low pass filter that smooths (blurs) noisy areas.
If you want a filter to operate on only salt and pepper noise, you have to
Something like
filteredImage = imgaussfilt(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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!