How to randomly select n number of pixels from an image whose value is one and change those pixels value to zero?

 採用された回答

ind = find(I == 1);
r = randperm(numel(ind));
r = r(1:n);
I(ind) = 0;

2 件のコメント

Anushka
Anushka 2015 年 5 月 28 日
thank you sir it worked.
Anushka
Anushka 2015 年 5 月 28 日
Sir what does the line r = r(1:n); does.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

タグ

タグが未入力です。

質問済み:

2015 年 5 月 28 日

コメント済み:

2015 年 5 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by