How would you detect a single noise pixel in an image matrix?

23 views (last 30 days)
Given an grayscale, image matrix of m by n, what methods can be applied to detect a single pixel of noise?
I attempted to first apply a Sobel operator. This results in the noise to appears as the following within the edge detected matrix:
[0 1 0; 1 0 1; 0 1 0];
In which the center at (2,2) is the noise pixel. I searched through the edge detected matrix. While, I found the pixels of noise, I also had a lot of false positives.
I do not think that this method would work, without either a supplemental method or attempting a new method all together. Likewise, this fails to account for noise pixels that too similar to the actual image (i.e. a noise value of 1 in the center of image values of 15-20).
EDIT:
Added example of single pixel being applied with example image.
In terms of words to describe noise, it is a single pixel that is anywhere from dark to bright. This does create issues that it can be impossible to detect. (In terms of the example posted, if it was applied by chance at (256,256), a value of 103-105.)
Going back to my attempt from earlier, NoiseAdded.jpg shows a random pixel of noise added, with NoiseAdded-Sobel, shows the pattern that is created upon the single pixel.

Accepted Answer

Image Analyst
Image Analyst on 12 Aug 2022
If you had to describe it in words, how would you describe "noise"? Is it values above or below some gloal threshold? Or above or below some threshold determined by the image values in a local, sliding window? Is it some value more than a certain number of standard deviations away from the mean?
See my salt and pepper noise removal demos, attached.
If you have any more questions, then attach your image and code to read it in with the paperclip icon after you read this:
and indicate which pixels you consider to be noise.
  3 Comments
Image Analyst
Image Analyst on 13 Aug 2022
Edited: Image Analyst on 13 Aug 2022
I'm not seeing a noticeable amount of noise in your noisy image. It just looks like a nice gray scale version of the original. To get a standard deviation filter you can do
grayImage = double(grayImage);
sdImage = stdfilt(grayImage, [7, 7]);
factor = 1.2; % Whatever
minImage = grayImage - factor * sdImage;
maxImage = grayImage + factor * sdImage;
noiseMask = (grayImage < minImage) | (grayImage > maxImage);
imshow(noiseMask);
If you just want to find a single pixel - the one with the most noise (difference) from it's local neighborhood, you can do
kernel = [1,1,1;1,0,1;1,1,1] / 8; % Average of 8 neighbors.
blurredImage = conv2(double(grayImage), kernel, 'same');
% Compute difference between center pixel and average of its 8 neighbors.
localDiffImage = abs(double(grayImage) - blurredImage);
% Find the max difference.
maxDiff = max(localDiffImage(:));
% Find row(s) and column(s) where the noise is largest.
[noisiestRow, noisiestCol] = find(localDiffImage == maxDiff)
Sonicflash
Sonicflash on 15 Aug 2022
Thank you. Your 2nd method of using conv2 worked great to find the pixel with most difference.

Sign in to comment.

More Answers (0)

Categories

Find more on Historical Contests in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!