Effacer les filtres
Effacer les filtres

How to find 2d discrete wavelet transform(dwt) for true color image

7 vues (au cours des 30 derniers jours)
cse batch4
cse batch4 le 9 Mar 2015
hi friends, how to find 2d discrete wavelet transform for true color image in matlab.please give some code example
  4 commentaires
Vidya P
Vidya P le 18 Mar 2017
i need the exact inverse DWT code for the above code. can you please provide that??
Walter Roberson
Walter Roberson le 18 Mar 2017
There have been quite a number of posts showing dwt2 and reconstruction.

Connectez-vous pour commenter.

Réponses (2)

Ajith Kumar
Ajith Kumar le 22 Nov 2017
Modifié(e) : Ajith Kumar le 22 Nov 2017
if true
%Read Input Image
Input_Image=imread('D:/mytest.png');
%Red Component of Colour Image
Red_Input_Image=Input_Image(:,:,1);
%Green Component of Colour Image
Green_Input_Image=Input_Image(:,:,2);
%Blue Component of Colour Image
Blue_Input_Image=Input_Image(:,:,3);
%Apply Two Dimensional Discrete Wavelet Transform
[LLr,LHr,HLr,HHr]=dwt2(Red_Input_Image,'haar');
[LLg,LHg,HLg,HHg]=dwt2(Green_Input_Image,'haar');
[LLb,LHb,HLb,HHb]=dwt2(Blue_Input_Image,'haar');
First_Level_Decomposition(:,:,1)=idwt2(LLr,LHr,HLr,HHr,'haar',size(Input_Image));
First_Level_Decomposition(:,:,2)=idwt2(LLg,LHg,HLg,HHg,'haar',size(Input_Image));
First_Level_Decomposition(:,:,3)=idwt2(LLb,LHb,HLb,HHb,'haar',size(Input_Image));
First_Level_Decomposition=uint8(First_Level_Decomposition);
%Display Image
figure;
subplot(1,2,1);imshow(Input_Image);title('Input Image');
subplot(1,2,2);imshow(First_Level_Decomposition,[]);title('Reconstructed image');
end

Ankita Bansal
Ankita Bansal le 23 Mai 2018
Inverse DWT code
Hi, I am assuming that you are using same syntax for coefficients as used in answer given above for calculating DWT. You can use idwt2 function available in MATLAB as following:
if true
% Reconstruction of signal
Red_Input_Image_reconstructed = uint8(idwt2(LLr,LHr,HLr,HHr,'haar'));
Green_Input_Image_reconstructed = uint8(idwt2(LLg,LHg,HLg,HHg,'haar'));
Blue_Input_Image_reconstructed = uint8(idwt2(LLb,LHb,HLb,HHb,'haar'));
% Checking whether data obtained after reconstruction is correct or not
x=[Red_Input_Image_reconstructed-Red_Input_Image];
y=[Green_Input_Image_reconstructed-Green_Input_Image];
z=[Blue_Input_Image_reconstructed-Blue_Input_Image];
max(max(x))
max(max(y))
max(max(z))
% Output Image after reconstruction
Output_Image(:,:,1)=Red_Input_Image_reconstructed;
Output_Image(:,:,2)=Green_Input_Image_reconstructed;
Output_Image(:,:,3)=Blue_Input_Image_reconstructed;
% Display Image after reconstruction
figure; imshow(Output_Image,[]);title('Reconstructed Image');
end
Instead of using “haar” or any other set of filter coefficients available in MATLAB, you can use your own set of filter coefficients for low pass and high pass filters for calculating Wavelet transform and Inverse Wavelet transform. But while calculating Inverse Wavelet transform you must use coefficients corresponding to the coefficients used at the time of decomposition.

Catégories

En savoir plus sur Discrete Multiresolution Analysis dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by