How to find 2d discrete wavelet transform(dwt) for true color image
조회 수: 6 (최근 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??
Walter Roberson
2017년 3월 18일
There have been quite a number of posts showing dwt2 and reconstruction.
답변 (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!