blob: 217b00c521420206bf6f3c44389aef1331c75ebd (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
function new_image = IDCT(image)
// Compute inverse Discrete Transform of image
//
// Calling Sequence
// newimage = IDCT(image)
//
// Parameters
// image : floating-point image
// newimage : IDCT of the input image
//
// Description
// The IDCT function computes the inverse cosine transform of a floating-point image with even number of rows and columns.
//
// Examples
// I = imread('cameraman.tif')
// I = double(I)
// J = IDCT(I)
// imshow(J)
//
// Authors
// Suraj Prakash
[rows, cols, channel] = size(image);
if (modulo(rows, 2) <> 0) & (modulo(cols, 2) <> 0) then
error(msprintf("Image doesnot have even number of rows and columns\n"));
elseif (modulo(rows, 2)) <> 0 then
error(msprintf("Image doesnot have even number of rows\n"));
elseif (modulo(cols, 2)) <> 0 then
error(msprintf("Image doesnot have even number of cols\n"));
end
if channel > 1 then
error(msprintf("Input image should be single channel"));
end
image_list = mattolist(image)
out = opencv_IDCT(image_list)
length_out = size(out)
for i = 1 : length_out
new_image(:, :, i) = out(i)
end
endfunction
|