Why am i getting error in wthresh? please help
Afficher commentaires plus anciens
% 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');
2 commentaires
Walter Roberson
le 13 Avr 2023
x is empty or length 1.
P N Ridu Varshini
le 13 Avr 2023
Réponses (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 commentaire
P N Ridu Varshini
le 13 Avr 2023
Catégories
En savoir plus sur Filter Banks dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!