Why am i getting error in wthresh? please help
Show older comments
% Load the noisy imagenoisyImage = imread('flower.jpg');
% Convert the noisy image to grayscale
grayImage = rgb2gray(noisyImage);
% Convert the grayscale image to double precision
grayImage = im2double(grayImage);
% Display the original noisy image
figure;
imshow(noisyImage);
title('Noisy Image');
% Perform Coiflet wavelet denoising
% Set the denoising parameters
waveletType = 'coif2'; % Coiflet wavelet type
level = 5; % Wavelet decomposition level
threshold = 'soft'; % Thresholding method
thrSettings = 3; % Thresholding settings
% Perform wavelet decomposition
[C, S] = wavedec2(grayImage, level, waveletType);
% Compute the noise estimate using universal thresholding
sigma = median(abs(C)) / 0.6745;
% Apply the thresholding
C = wthresh(C, threshold, sigma * thrSettings);
% Perform inverse wavelet transform to obtain the denoised image
denoisedImage = waverec2(C, S, waveletType);
% Display the denoised image
figure;
imshow(denoisedImage);
title('Denoised Image');
Answers (1)
I believe the issue is with your 2nd input. Valid inputs are 's' and 'h'. You are using 'soft'.
y = linspace(-1,1,100);
thr = 0.4;
% good
ythard = wthresh(y,'s',thr);
% error
ythard = wthresh(y,'soft',thr);
1 Comment
P N Ridu Varshini
on 13 Apr 2023
Categories
Find more on Filter Banks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!