フィルターのクリア

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

1 回表示 (過去 30 日間)
Luke Butcher
Luke Butcher 2019 年 2 月 26 日
編集済み: Image Analyst 2019 年 2 月 26 日
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 件のコメント
Image Analyst
Image Analyst 2019 年 2 月 26 日
編集済み: Image Analyst 2019 年 2 月 26 日
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"

サインインしてコメントする。

採用された回答

Niti K
Niti K 2019 年 2 月 26 日
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

その他の回答 (0 件)

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by