フィルターのクリア

imnoise(I,'salt & pepper',D)

4 ビュー (過去 30 日間)
Alex Dashevsky
Alex Dashevsky 2017 年 5 月 12 日
回答済み: Image Analyst 2017 年 5 月 12 日
I don't understand how I know how many pixels are black and how many white ? salt=white ? pepper=black ?
  1 件のコメント
Adam
Adam 2017 年 5 月 12 日
Does it matter which is which for the noise? It's just a boolean, on or off effectively.

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

回答 (1 件)

Image Analyst
Image Analyst 2017 年 5 月 12 日
Try this to measure what it produced:
numBlackPixels = nnz(grayImage == 0)
numWhitePixels == nnz(grayImage == 255)
Because the help says "J = imnoise(I,'salt & pepper',d) adds salt and pepper noise to the image I, where d is the noise density. This affects approximately d*numel(I) pixels. The default for d is 0.05." then (numBlackPixels + numWhitePixels)/numel(grayImage) should approximately equal the value of d you used. I think it's safe to assume the proportion of black pepper noise and white salt noise should be about the same - 50% of each type.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by