forked from sigproc/cued_sf2_lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdwt.py
More file actions
31 lines (24 loc) · 623 Bytes
/
dwt.py
File metadata and controls
31 lines (24 loc) · 623 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from cued_sf2_lab.dwt import nlevdwt, nlevidwt, quantdwt
from cued_sf2_lab.familiarisation import load_mat_img, plot_grid
import matplotlib.pyplot as plt
import numpy as np
plt.style.use("graphs.mplstyle")
X, _ = load_mat_img(img="lighthouse.mat", img_info="X", cmap_info={"map", "map2"})
X = X - 128.0
n = 4
Y = nlevdwt(X, n)
dwtstep = np.ones((3,n+1))*10
Yq, dwtenc = quantdwt(Y, dwtstep)
Z = nlevidwt(Yq, n)
plot_grid(
[
(X, "Original image X"),
(Y, "DWT Y"),
(Yq, f"Quantised Yq"),
(Z, f"DCT compressed Z"),
],
nrows=2,
ncols=2,
sharex=True,
sharey=True,
)