From a6df67e8bcd5159cde27556f4f6a315f8dc2215f Mon Sep 17 00:00:00 2001 From: shamikam Date: Mon, 16 Jan 2017 02:56:17 +0530 Subject: First Commit --- macros/IDCT.sci | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 macros/IDCT.sci (limited to 'macros/IDCT.sci') diff --git a/macros/IDCT.sci b/macros/IDCT.sci new file mode 100644 index 0000000..217b00c --- /dev/null +++ b/macros/IDCT.sci @@ -0,0 +1,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 -- cgit