Perform operations on non-zero locations of the matrix

2 visualizaciones (últimos 30 días)
lech king
lech king el 8 de Oct. de 2020
Comentada: Ameer Hamza el 8 de Oct. de 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

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 8 de Oct. de 2020
mask = pic3 > 0; % mask for non-zero values of pic3
pic3(mask) = pic3(mask) - 80;

Más respuestas (0)

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by