
418 A Computational Introduction to Digital Image Processing, Second Edition
MATLAB/Octave
>> bq2 = bq.
*
q
>> bd2 = idct2(bq2)
>> block2 =
round
(bd2+128)
In Python, as before, we have to provide a function for the inverse DCT:
Python
In : def idct2(x):
...:
return
idct(idct(x,norm=’ortho’).T,norm=’ortho’).T
...:
In : bq2 = bq
*
q
In : bd2 = idct2(bq2)
In : block2 = np.round(bd2+128)
The value of
block2
is:
80 89 88 74 62 59 58 53
75 81 77 63 54 56 59 58
57 62 58 48 47 58 68 70
60 66 68 66 73 90 102 104
98 106 111 113 123 137 143 139
130 135 137 137 143 153 152 144
131 133 129 126 133 144 144 136
125 124 118 114 124 141 147 143
It can be seen that these values are very