Perform operations on non-zero locations of the matrix

1 vue (au cours des 30 derniers jours)
lech king
lech king le 8 Oct 2020
Commenté : Ameer Hamza le 8 Oct 2020
pic1=rgb2gray(pic);
pic2 = imnoise(pic1,'salt & pepper',0.05);
%%%%%%%Hard Thresholding%%%%%%
Container=pic2>80;
Container=uint8(Container);
pic3=pic2.*Container;
Hi
this is my Hard Thresholding in pic3
now i want Soft Thresholding by subtracting the places have non-zero values in pic3 from 80 without using a loop
Thanks for your guidance

Réponse acceptée

Ameer Hamza
Ameer Hamza le 8 Oct 2020
mask = pic3 > 0; % mask for non-zero values of pic3
pic3(mask) = pic3(mask) - 80;
  2 commentaires
lech king
lech king le 8 Oct 2020
thank you so much
Ameer Hamza
Ameer Hamza le 8 Oct 2020
I am glad to be of help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by