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!