Data and Image Compression: Assignements
S. Xambó
In this page (WiP) each section corresponds to a
weekly assignement for the Data and Image Compression class
of the Spring Semestrer 2014-2015 at the
FIB
of the UPC.
The A2 to A6 denote assignements in the period February to June.
The next two digits denote the day of the month in which the assignement is proposed.
A217
-
Write a function sum_powers(N,k)
that yields, given positive integers N and k,
the sum of the powers nk,
for n in the range 1,2,...,N.
-
Write a function delete_multiples(k,L) that returns, given an integer
k and a list L
of integers, the list obtained after deleting from L
all the multiples of k.
-
Upgrade the previous function to a function delete_multi_multiples(K,L),
where now K is an integer or a list of integers,
that returns the list obtained from L after deleting all the multiples
of all the integers in K.
Hint. To check whether x is an integer (list),
use isinstance(x,int)
(isinstance(x,list)).
Solution:
A217.py
A224
-
With the notations of T0.10, let PY be
list of probabilities of the events Yj
(the hypotheses) and L
the list of the probabilities P(X|Yj)
(the likelihoods). Define a function that yields
the list of condicional probabilities P(Yj|X)
taking PY and L
as inputs.
-
If X is itself a list of events Xi
and L is the matrix of likelihoods
P(Xi|Yj),
write a function that gives the matrix of conditional probablilities
P(Yj|Xi)
taking PY and L
as inputs.
Solution:
A224
A303
Repeat the work done in L303 with the data provided by
Monogram English, with the following
improvements: generate and encode messages of random length and include
suitable error controls in the encoding and decoding functions.
Solutions:
A303_Llueca,
A303_Martin.
A310
Write code that generates the graphics on pages 4 and 17 of
T2. Pay attention to details,
including mathematical texts and the relative size of the axes.
Solution:
A310_Llueca.
A317
Construction of an optimal encoding and related questions:
A317_x.
Solution:
A317.
Mentions: A317_Gines,
A317_Martin,
A317_Rodriguez.
A324
This image above describes the Morse code and the time units involved in transmitting characters.
Find the average number of time units needed to transmit a an English letter.
Follow the instructions in
A324_x.
Solution:
A324.
Mentions: A324_Boixaderas,
A324_Martin.
A407
-
Define a funtion Y = RC(X,f)
that implements residual coding of the numerical list X
using the function f (defined for non-negative integers)
as a model. Check it with the example on page T5.9. Define also a function
X = RD(Y,f) that implements the corresponding decoding.
-
Define similar functions Y = PC(X)
and X = PD(Y) (predictive coding and decoding), where
yj = xj-(xj-2+xj-1)/2,
with the convention that x-2=x-1=0.
Test them with some suitable examples.
Solution:
A407.
Mentions: A407_Baqués,
A407_Domínguez,
A407_Ginés,
A407_Llueca,
A407_Martin,
A407_Puente,
A407_Rodriguez,
A407_Sánchez.
A414
In the same mood as for L409,
and using what you learned in L414,
compute Haar transforms of level 2 and 3 of your favorite signal and draw their graphics
much as in the example on T6.7.
Solutions:
Ginés,
Puente
Mentions: Lafita,
Llueca,
Pascual.
A421
Basically, this assignement consists in working out point 4 of
L423_x.py.
-
Use the expressions on T6.14 for
Ar(f, r)
and Dr(f, r),
and the scaling and wavelet arrays,
to define funtions that compute them.
-
Pick your favorite signal f (to be useful, it shoul be
reasonably tame) and use the technique of vertical offsets to represent
the Ar(f, r),
for a suitable range of r, in a single canvas. Ditto for
Dr(f, r).
-
Compare the results with similar computations using high_filter
and low_filter.
Solution:
A421. Mentions:
Ginés,
Martín,
Velisek.
Note.The Haar algorithms worked out so far
have been included in cdi_haar.
They will be part of cdi_wavelets after
the study of the Daubechies wavelets (T7).
A428
Draw the graph of D4(f)
for your favorite signal f.
Compare the result with D2(f).
Solutions:
Boixaderas,
Ginés,
Lafita,
Llueca,
Martín,
Mingorance,
Sánchez,
Velisek.
A505
Draw graphics of some Daub4 scaling and wavelet vectors
of different levels. You can adapt the analogous exercise done
for the Haar wavelets.
Solutions:
Lafita,
Martín,
Sánchez.
Mentions:
Baqués,
Domínguez,
Ginés,
Mingorance,
Puente,
Velisek.
A512
By analogy with L423, choose your favorite signal f
(to be useful it should be not too wild) and compute the
arrays Ar(f,r) and
Dr(f,r)
by using the scaling and wavelet vectors and by using the method of filters.
Present the results in suitable graphical representations.
Solutions:
Martín,
Puente.
Mentions:
Baqués,
Domínguez,
Galicia,
Ginés,
Mateo,
Mingorance,
Pascual,
Sánchez.
A519
By analogy with L519 and L521, work out the following points:
- Chose a discrete signal f of length
210 by sampling your
favourite function, and compute a = D4trend(f,3).
-
Repeat L521 to find the decompression of a
using D2, D4 and D6.
-
Produce apropriate graphic representations of the results.
-
Write some relevant conclusions in a few sentences (can be in the form of a long comment).
Solution:
Velisek
Mentions:
Baqués,
Bertran,
Delgado,
Domínguez,
Galicia,
Ginés,
Lafita,
Llueca (timing method),
Martín,
Mateo,
Pascual,
Porras,
Prat,
Puente,
Sánchez,
Velisek.
A526
Work on DCT.
CDI15
| SXD