Perform operations on non-zero locations of the matrix
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Ameer Hamza
2020-10-8
mask = pic3 > 0; % mask for non-zero values of pic3
pic3(mask) = pic3(mask) - 80;
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Read, Write, and Modify Image 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!