How to alter an image so noise is reduced by using a threshold within a loop

1 Ansicht (letzte 30 Tage)
So if we want a for loop to go pixel by pixel in an image we have created or defined and change it IN RELATION to its neighbors, what should we do?
for example, if the pixel value (between 0 and 255) is <0, and if two or fewer of its neighbors are also <0, we would like to change the value to 0. Otherwise, we want to leave it as is.
  1 Kommentar
Image Analyst
Image Analyst am 26 Feb. 2019
Bearbeitet: Image Analyst am 26 Feb. 2019
It sounds like you have an Answer since you've accepted the one below (though I don't know how it solves your question), but if the pixel value is "between 0 and 255" then how can it ever be "<0"???
And why do you think you need a loop for this? And what would it loop over? Intensities? Pixel locations? What is your loop index - what does it represent: gray level or rows and columns?
Are you trying to describe the "sigma filter"

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Niti K
Niti K am 26 Feb. 2019
One way would be to define a windowsize (2 in your case) and have your for loops go from 1:size-Windows.
you can add an if condition such that if adjacent pixels surrounding the pixel in question are less than zero, you can assign that pixel value 0.
test.JPG

Weitere Antworten (0)

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by