Why am i getting error in wthresh? please help
Ältere Kommentare anzeigen
% 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 Kommentare
Walter Roberson
am 13 Apr. 2023
x is empty or length 1.
P N Ridu Varshini
am 13 Apr. 2023
Antworten (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 Kommentar
P N Ridu Varshini
am 13 Apr. 2023
Kategorien
Mehr zu Filter Banks finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!