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

 Réponse acceptée

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

Plus de réponses (0)

Catégories

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by