[Image compression] image compression matlab source code based on wavelet transform

1. Introduction

In 1974, the French engineer J. Morlet first proposed the concept of wavelet transform. In 1986, the famous mathematician Y. Meyer accidentally constructed a real wavelet base, and cooperated with S. Mallat to establish a multi-scale analysis to construct the wavelet base. Analysis has only begun to flourish. Wavelet analysis has a wide range of applications. In mathematics, it has been used in numerical analysis, construction of fast numerical methods, curve and surface construction, differential equation solving, cybernetics, etc. Filtering, noise removal, compression, transmission, etc. in signal analysis. Image compression, classification, identification and diagnosis in image processing, noise removal, etc. This chapter will focus on the application analysis of wavelet in images.
1 Principle of Wavelet Transform
Wavelet analysis is a more difficult branch. The user adopts wavelet transform to realize image compression, vibration signal decomposition and reconstruction, etc., so it is widely used in practical engineering. Compared with Fourier transform, wavelet analysis is a local transform of space domain and frequency domain, so it can extract information from signal effectively. The wavelet transform realizes the multi-scale decomposition and reconstruction of the signal through basic operations such as scaling and translation, thereby largely solving many problems caused by the Fourier transform.
Wavelet analysis is a new branch of mathematics. It is the perfect crystallization of functional analysis, Fourier analysis, and numerical analysis. Wavelet analysis is also a new technology of "time-scale" analysis and multi-resolution analysis. It is used in signal analysis and speech synthesis. , Image compression and recognition, atmospheric and ocean wave analysis, etc., have a wide range of applications.
(1) Wavelet analysis is used for signal and image compression. The characteristics of wavelet compression are high compression ratio, fast compression speed, can keep the characteristics of signal and image unchanged after compression, and can resist interference in transmission. There are many compression methods based on wavelet analysis, including wavelet compression, wavelet packet compression, wavelet transform vector compression, etc.
(2) Wavelet can also be used for signal filtering and denoising, signal time-frequency analysis, signal-to-noise separation and extraction of weak signals, fractal index, signal identification and diagnosis, and multi-scale edge detection.
(3) The application of wavelet analysis in engineering technology, etc., includes computer vision, curve design, turbulence, remote universe research and biomedicine.
2 Multi-scale analysis
Insert picture description here
3 Image decomposition and quantization
Insert picture description here
4 Image compression coding
Insert picture description here
5 Image coding evaluation
Insert picture description here

Second, the source code

%第一层小波分解
clc,clear
load wbarb;
image(X);
colormap(map);
colorbar;
% 小波分解
[cA1,cH1,cV1,cD1] = dwt2(X,'bior3.7');
% 第一层小波逼近系数--cA1
% 水平系数--cH1
% 垂直系数--cV1
% 对角系数--cD1
A1 = upcoef2('a',cA1,'bior3.7',1);
H1 = upcoef2('h',cH1,'bior3.7',1); 
V1 = upcoef2('v',cV1,'bior3.7',1);
D1 = upcoef2('d',cD1,'bior3.7',1);
%显示第一层小波分解图形
colormap(map);
subplot(2,2,1); image(wcodemat(A1,192));
title('第一层小波逼近系数A1')
subplot(2,2,2); image(wcodemat(H1,192));
title('第一层小波水平系数H1')
subplot(2,2,3); image(wcodemat(V1,192));
title('第一层小波垂直系数V1') 
subplot(2,2,4); image(wcodemat(D1,192));
title('第一层小波对角系数D1')


%% 由单层逆小波变换重新产生一副图像
% 逆变换
Xsyn = idwt2(cA1,cH1,cV1,cD1,'bior3.7');
%To perform a level 2 decomposition of the image
[C,S] = wavedec2(X,2,'bior3.7'); 
%To extract the level 2 approximation coefficients from C
cA2 = appcoef2(C,S,'bior3.7',2);
%To extract the first- and second-level detail coefficients from C
cH2 = detcoef2('h',C,S,2);
cV2 = detcoef2('v',C,S,2);
cD2 = detcoef2('d',C,S,2);
cH1 = detcoef2('h',C,S,1);
cV1 = detcoef2('v',C,S,1);
cD1 = detcoef2('d',C,S,1);
%To reconstruct the level 2 approximation from C
A2 = wrcoef2('a',C,S,'bior3.7',2);
%To reconstruct the level 1 and 2 details from C
H1 = wrcoef2('h',C,S,'bior3.7',1);
V1 = wrcoef2('v',C,S,'bior3.7',1);
D1 = wrcoef2('d',C,S,'bior3.7',1);
H2 = wrcoef2('h',C,S,'bior3.7',2);
V2 = wrcoef2('v',C,S,'bior3.7',2);
D2 = wrcoef2('d',C,S,'bior3.7',2);
end

Three, running results

Insert picture description here

Four, remarks

Complete code or write on behalf of adding QQ1575304183

Past review>>>>>>

[Image clustering] Based on FCM and improved FCM brain CT image clustering processing

[Image enhancement] Image enhancement matlab source code of PSO seeking optimization ACE

[Image enhancement] Gray-scale image enhancement based on region similarity transformation function and dragonfly algorithm

[Image enhancement] CLAHE algorithm based on local contrast enhancement-histogram enhancement
[Image reconstruction] ASTRA algorithm matlab source code for image reconstruction

[Image evaluation] Image quality evaluation based on CCF algorithm

[Image hiding] Image encryption and decryption based on chaotic system matlab source code with GUI

[Image hiding] Based on DWT+DCT+PBFO to improve image watermark hiding and extraction matlab source code with GUI

[Image hiding] Image hiding matlab source code based on orthogonal Latin square scrambling

[Image hiding] Image hiding matlab source code based on Laguerre transform

Guess you like

Origin blog.csdn.net/qq_34763204/article/details/113719920