How to find 2d discrete wavelet transform(dwt) for true color image
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi friends, how to find 2d discrete wavelet transform for true color image in matlab.please give some code example
4 comentarios
Vidya P
el 18 de Mzo. de 2017
i need the exact inverse DWT code for the above code. can you please provide that??
Walter Roberson
el 18 de Mzo. de 2017
There have been quite a number of posts showing dwt2 and reconstruction.
Respuestas (2)
Ajith Kumar
el 22 de Nov. de 2017
Editada: Ajith Kumar
el 22 de Nov. de 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
0 comentarios
Ankita Bansal
el 23 de Mayo de 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.
0 comentarios
Ver también
Categorías
Más información sobre Wavelet Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!