How to find 2d discrete wavelet transform(dwt) for true color image
7 次查看(过去 30 天)
显示 更早的评论
hi friends, how to find 2d discrete wavelet transform for true color image in matlab.please give some code example
4 个评论
Vidya P
2017-3-18
i need the exact inverse DWT code for the above code. can you please provide that??
回答(2 个)
Ajith Kumar
2017-11-22
编辑:Ajith Kumar
2017-11-22
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 个评论
Ankita Bansal
2018-5-23
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!