MATLAB Answers

Doubt about the result of my function (dwt2)

1 ビュー (過去 30 日間)
Kelvin Prado
Kelvin Prado 2016 年 9 月 10 日
コメント済み: Kelvin Prado 2016 年 10 月 4 日
I created a function that basically receives an image as parameter and apply the discrete 2D wavelet transform using only the LL (cA) result and then apply the inverse discrete 2D wavelet transform to get the original size of the image:
function newImage = discWaveletTransform2D(img, level, wname)
% Clear all variables and close all windows
clear vars
close all
% Apply the discrete 2D wavelet transform
% Note: uses only the LL result to transform
for i=1:level
[img,LH,HL,HH] = dwt2(img, wname)
end
% Apply the inverse discrete 2D wavelet transform
% Used to reconstruct the image
% Note: uses only the LL result to transform
for i=1:level
img = idwt2(img,[],[],[], wname)
end
newImage = img
end
I call the function using these commands:
img = imread('C:\MyImage.png')
img = discWaveletTransform2D(img, 2, 'db2')
image(img)
If I test the function using the clown image provided by matlab, I can get the following result:
% Using:
load clown
img = discWaveletTransform2D(X, 2, 'db2')
image(img)
Original:
Result:
But, if I try to use another image, for example, this one:
I get the following result:
Is it normal?
Can someone explain to me why this is happening?
Can I do something to get a better representation of the original image?
Thanks in advance

回答 (1 件)

Wayne King
Wayne King 2016 年 10 月 4 日
Why are you not using wavedec2?
  1 件のコメント
Kelvin Prado
Kelvin Prado 2016 年 10 月 4 日
Because I didn't know about it.
I will try to use it.
Thanks

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by