diff options
author | shamikam | 2017-01-16 02:56:17 +0530 |
---|---|---|
committer | shamikam | 2017-01-16 02:56:17 +0530 |
commit | a6df67e8bcd5159cde27556f4f6a315f8dc2215f (patch) | |
tree | e806e966b06a53388fb300d89534354b222c2cad /macros/IDCT.sci | |
download | FOSSEE_Image_Processing_Toolbox-master.tar.gz FOSSEE_Image_Processing_Toolbox-master.tar.bz2 FOSSEE_Image_Processing_Toolbox-master.zip |
Diffstat (limited to 'macros/IDCT.sci')
-rw-r--r-- | macros/IDCT.sci | 46 |
1 files changed, 46 insertions, 0 deletions
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 |